[LLVMdev] How basic block layout is determined during scheduling?
t.p.northover at gmail.com
Wed Sep 18 04:24:59 PDT 2013
> bnz R2, LBB0_34
> I do not have any clue what happens when compiling with -O2.
> Can someone make a suggestion?
Is the "bnz" instruction marked "isBarrier" in your TableGen files? If
so, that would mean LLVM considers fallthrough impossible and decides
it can move LBB0_33 around at will. It's still very odd that it thinks
it can put it directly before LBB0_34 though.
It would be interesting to see the blocks before and after the "Basic
block placement" pass. Running llc with -print-after-all and/or -debug
might well shed some light on what's happening.
Other possible bugs are in implementations of AnalyzeBranch,
InsertBranch or RemoveBranch. They're target callbacks LLVM uses to do
its more invasive block movement. The place to start debugging is
lib/CodeGen/MachineBlockPlacement.cpp. Something in there is probably
More information about the llvm-dev