[llvm-commits] [llvm] r105387 - in /llvm/trunk: lib/CodeGen/MachineSink.cpp test/CodeGen/X86/MachineSink-CritEdge.ll test/CodeGen/X86/sink-hoist.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Jun 3 16:51:22 PDT 2010


On Jun 3, 2010, at 4:44 PM, Bill Wendling wrote:

> On Jun 3, 2010, at 10:46 AM, Jakob Stoklund Olesen wrote:
> 
>> On Jun 3, 2010, at 12:54 AM, Bill Wendling wrote:
>>> 
>>> ... = imul ... EFLAGS<imp-def,dead>
>>> test ..., EFLAGS<imp-def>
>>> jcc BB#2 EFLAGS<imp-use>
>>> 
>>> BB#1
>>> ... ; fallthrough to BB#2
>>> 
>>> BB#2
>>> ... ; No code that defines EFLAGS
>>> jcc ... EFLAGS<imp-use>

[...]

>> Coalescing and register allocation update the livein lists. If there are other passes using physical registers across blocks, they should update the livein lists as well.
>> 
> This is happening before register allocation and coalescing. This is coming from a "select" statement, which gets lowered down into a diamond if-then pattern on X86. It's there that we get the live across blocks stuff.

OK, that makes sense. It feels like a bug to me, but maybe we are only tracking allocatable livein registers?

>> Maybe there is some confusion about the difference between unallocatable and reserved registers. IIRC, EFLAGS is unallocatable, but not reserved.
>> 
>> Do you know which pass creates the cross-block use of EFLAGS to begin with?
>> 
> It's that way after instruction selection. Probably from here: X86TargetLowering::EmitLoweredSelect

Would it be possible to fix this bug by properly marking EFLAGS as livein in that function instead?

/jakob





More information about the llvm-commits mailing list