[llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll

Evan Cheng evan.cheng at apple.com
Mon Sep 21 17:07:23 PDT 2009


On Sep 21, 2009, at 3:34 PM, Bill Wendling wrote:

> On Sep 21, 2009, at 2:39 PM, Evan Cheng wrote:
>
>>
>> On Sep 21, 2009, at 2:19 PM, Bill Wendling wrote:
>>
>>>>
>>> This loop is dead is "HasDef" and "HasUse" are both true. :-)
>>
>> That's not possible. isDef() the opposite of isUse().
>>
> Yes, but the only affect of the "|=" operator on a boolean is to  
> turn it from a "false" to a "true". If HasDef and HasUse are already  
> true after their initializations, then the loop will can't turn them  
> "false". :-)

I don't understand your point. Before the loop, HasDef and HasUse  
cannot both be true. The only possible simplification here is an early  
exit out of the loop if both HasDef and HasUse have become true.

Evan

>
> -bw
>
>        bool HasDef = mopi.isDef();
>        bool HasUse = mopi.isUse();
>        for (unsigned j = i+1; j != e; ++j) {
>          const MachineOperand &mopj = MI->getOperand(j);
>          if (!mopj.isReg() || mopj.getReg() != Reg)
>            continue;
>          HasDef |= mopj.isDef();
>          HasUse |= mopj.isUse();
>        }
>
>




More information about the llvm-commits mailing list