Loop Rotation in MachineBlockPlacement

Hi.

I have this nested loop. When loop@Depth3 is processed, BB#193 is the exiting block. And when loop@Depth2 is processed, the loop is rotated w.r.t BB#193 because PreferredLoopExit is not cleared. This does not seem right to me as BB#193 does not even exit loop@Depth2. Should not we clear PreferredLoopExit everytime we process a new loop ?

BB#193: derived from LLVM BB %cleanup.i.i781

Live Ins: %RAX %RBP %RBX %RSI %R9 %R10 %R11 %R13 %R14 %R15

Predecessors according to CFG: BB#192

%RBX<def,tied1> = ADD64ri8 %RBX<kill,tied0>, 8, %EFLAGS<imp-def,dead>

%RBP<def,tied1> = ADD64ri8 %RBP<kill,tied0>, 8, %EFLAGS<imp-def,dead>

CMP64rr %RBX, %R15, %EFLAGS

JB_1 <BB#192>, %EFLAGS

JMP_1 <BB#174>

Successors according to CFG: BB#192(0x7fef9fcb / 0x80000000 = 99.95%) BB#174(0x00106035 / 0x80000000 = 0.05%)

Loop at depth 2 containing: BB#191,BB#192,BB#182,BB#193,BB#174,BB#175,BB#176,BB#177,BB#178,BB#179,BB#180,BB#181,BB#183,BB#187,BB#184,BB#185,BB#186,BB#188,BB#189,BB#190

Loop at depth 3 containing: BB#192,BB#193

Thanks

-Xin

looks like a bug to me.

David