[LLVMdev] Question about /llvm/trunk/lib/CodeGen/MachineScheduler.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Feb 10 16:13:52 PST 2012

On Feb 10, 2012, at 2:48 PM, Andrew Trick <atrick at apple.com> wrote:

> On Feb 10, 2012, at 12:14 PM, Sergei Larin <slarin at codeaurora.org> wrote:
>> 1) Can a BB presented to the MI scheduler be _not_ terminated (end on a non
>> terminator MI) under any circumstances? Below you are speaking about "Empty
>> blocks, or blocks with only a single instruction that not a terminator..." -
>> What about the BB#4 below? Is it OK?
> I don't *think* any MI pass should require terminators for single successor blocks laid out sequentially.


> It seems obvious to me that a block with multiple successors needs a terminator, but I don't know exactly where that's verified.

It's not. In fact, a block can have a landing pad and a fall-through successor, and still not have a terminator. (Invokes ought to be terminators, but they currently aren't).

> On the other hand, prior to code placement, I often see unnecessary unconditional jumps. So I'm not sure what is considered best practice. Hopefully someone else on the list will clarify.

Most targets try to keep branches minimal at all times, I think. It doesn't always work, so sometimes CodePlacementOpt has to clean it up.


More information about the llvm-dev mailing list