Hi : The bb-reorder pass is relative simple comparing with others, but still I got following puzzles. 1 : the comment at top of the bb-reorder.c file says that :
There are two parameters: Branch Threshold and Exec Threshold. If the edge to a successor of the actual basic block is lower than Branch Threshold or the frequency of the successor is lower than Exec Threshold the successor will be the seed in one of the next rounds. but when computing which_heap in function "find_traces_1_round", it uses push_to_next_round_p to decide whether the successor should go to next round, which takes only exec_th as argument, not branch_th. Is this inconsistent ? 2 : when checking for situation : A / | B | \ | C gcc uses the condition EDGE_FREQUENCY (AB) + EDGE_FREQUENCY (BC) >= EDGE_FREQUENCY (AC). what does "EDGE_FREQUENCY (AB) + EDGE_FREQUENCY (BC)" stand for? Since edge B is dominated by A and C is the only successor, the frequency of path(ABC) is less than path(AC), I think. 3 : It is possible to merge two traces by copying exactly one basic block. gcc uses following code to take trace which has only one bb into consider: if (bbd[e->dest->index].start_of_trace >= 0 && traces[bbd[e->dest->index].start_of_trace].length == 1) { best = e; try_copy = true; continue; } Here is the question, what about that trace has already been merged and has no free successor traces(traces which start bb is the successor of the single bb). in this situation next_bb is NULL and all we did is just copy a already merged bb. Is this right? Please correct me and help me out, Thanks. -- Best Regards.