[llvm-commits] [llvm] r111221 - in /llvm/trunk: lib/CodeGen/MachineBasicBlock.cpp lib/CodeGen/PHIElimination.cpp test/CodeGen/ARM/code-placement.ll test/CodeGen/X86/lsr-reuse.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Aug 17 13:08:59 PDT 2010


On Aug 17, 2010, at 12:50 PM, Evan Cheng wrote:
>> @@ -392,8 +393,14 @@
>>     // We break edges when registers are live out from the predecessor block
>>     // (not considering PHI nodes). If the register is live in to this block
>>     // anyway, we would gain nothing from splitting.
>> -      if (!LV.isLiveIn(Reg, MBB) && LV.isLiveOut(Reg, *PreMBB))
>> -        Changed |= PreMBB->SplitCriticalEdge(&MBB, this) != 0;
>> +      // Avoid splitting backedges of loops. It would introduce small
>> +      // out-of-line blocks into the loop which is very bad for code placement.
>> +      if (PreMBB != &MBB &&
>> +          !LV.isLiveIn(Reg, MBB) && LV.isLiveOut(Reg, *PreMBB)) {
>> +        if (!(MLI->getLoopFor(PreMBB) == MLI->getLoopFor(&MBB) &&
>> +              MLI->isLoopHeader(&MBB)))
>> +          Changed |= PreMBB->SplitCriticalEdge(&MBB, this) != 0;
>> +      }
>>   }
>> }
>> return true;
>> 
>> You're doing it again ;-) You shouldn't expect MLI to be non-NULL here.
> 
> This is in PHI elimination which is explicitly asking for machineloopinfo. Can it ever be null?

So it does. I was fooled by this line:

  MLI = getAnalysisIfAvailable<MachineLoopInfo>();

But you probably don't want to require MachineLoopInfo for PHIElimination. I don't think we want to calculate that in a -O0 build.

/jakob





More information about the llvm-commits mailing list