[llvm-commits] [llvm] r95749 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Dale Johannesen dalej at apple.com
Wed Feb 10 10:42:07 PST 2010


On Feb 9, 2010, at 6:02 PMPST, Chris Lattner wrote:

>
> On Feb 9, 2010, at 5:31 PM, Dale Johannesen wrote:
>
>> Author: johannes
>> Date: Tue Feb  9 19:31:26 2010
>> New Revision: 95749
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=95749&view=rev
>> Log:
>> Rewrite loop to suit Chris' preference.
>
> The second !mi->isDebugValue() you added is now dead.

That is needed for the case where a block ends with DEBUG_VALUE.   
Without that check baseIndex would point too far ahead after the loop.

> -Chris
>
>>
>>
>> Modified:
>>   llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95749&r1=95748&r2=95749&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> = 
>> =====================================================================
>> --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb  9  
>> 19:31:26 2010
>> @@ -611,23 +611,26 @@
>>
>>  MachineBasicBlock::iterator E = MBB->end();
>>  while (mi != E) {
>> -    if (!mi->isDebugValue()) {
>> -      if (mi->killsRegister(interval.reg, tri_)) {
>> -        DEBUG(dbgs() << " killed");
>> -        end = baseIndex.getDefIndex();
>> -        SeenDefUse = true;
>> -        break;
>> -      } else if (mi->modifiesRegister(interval.reg, tri_)) {
>> -        // Another instruction redefines the register before it is  
>> ever read.
>> -        // Then the register is essentially dead at the  
>> instruction that defines
>> -        // it. Hence its interval is:
>> -        // [defSlot(def), defSlot(def)+1)
>> -        DEBUG(dbgs() << " dead");
>> -        end = start.getStoreIndex();
>> -        SeenDefUse = true;
>> -        break;
>> -      }
>> +    if (mi->isDebugValue()) {
>> +      ++mi;
>> +      continue;
>>    }
>> +    if (mi->killsRegister(interval.reg, tri_)) {
>> +      DEBUG(dbgs() << " killed");
>> +      end = baseIndex.getDefIndex();
>> +      SeenDefUse = true;
>> +      break;
>> +    } else if (mi->modifiesRegister(interval.reg, tri_)) {
>> +      // Another instruction redefines the register before it is  
>> ever read.
>> +      // Then the register is essentially dead at the instruction  
>> that defines
>> +      // it. Hence its interval is:
>> +      // [defSlot(def), defSlot(def)+1)
>> +      DEBUG(dbgs() << " dead");
>> +      end = start.getStoreIndex();
>> +      SeenDefUse = true;
>> +      break;
>> +    }
>> +
>>    ++mi;
>>    if (mi != E && !mi->isDebugValue()) {
>>      baseIndex = indexes_->getNextNonNullIndex(baseIndex);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list