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

Bill Wendling isanbard at gmail.com
Thu Jun 3 17:48:49 PDT 2010


On Jun 3, 2010, at 4:51 PM, Jakob Stoklund Olesen wrote:

> 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?

That's what I got from the comment at the top of LiveVariables...and we all know that comments never lie. :-)

>>> 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?
> 
I think it would be good to do this for all pregs (allocatable or no). But we would need a special "liveness pass" to fix it.

-bw





More information about the llvm-commits mailing list