[polly] r177643 - Remove last uses of canoncial induction variable when scev code generating

Tobias Grosser tobias at grosser.es
Fri Mar 22 06:40:59 PDT 2013


On 03/21/2013 08:53 PM, Sebastian Pop wrote:
> Tobias Grosser wrote:
>> Author: grosser
>> Date: Thu Mar 21 11:14:50 2013
>> New Revision: 177643
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=177643&view=rev
>> Log:
>> Remove last uses of canoncial induction variable when scev code generating
>> +  if (!SCEVCodegen) {
>> +    // If code generation is not in scev based mode, we need to ensure that
>> +    // each loop has a canonical induction variable.
>> +    PHINode *IndVar = L->getCanonicalInductionVariable();
>> +    if (!IndVar)
>> +      INVALID(IndVar,
>> +              "No canonical IV at loop header: " << L->getHeader()->getName());
>> +  }
>>
>>     // Is the loop count affine?
>>     const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
>>
>> Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=177643&r1=177642&r2=177643&view=diff
>> ==============================================================================
>> --- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
>> +++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Mar 21 11:14:50 2013
>> @@ -592,8 +592,8 @@ ScopStmt::ScopStmt(Scop &parent, TempSco
>>     // Setup the induction variables.
>>     for (unsigned i = 0, e = Nest.size(); i < e; ++i) {
>>       PHINode *PN = Nest[i]->getCanonicalInductionVariable();
>> -    assert(PN && "Non canonical IV in Scop!");
>> -    IVS[i] = PN;
>> +    if (PN)
>> +      IVS[i] = PN;
>
> What about also checking for !SCEVCodegen before calling getCanonicalInductionVariable?
> That would avoid a useless call to getCanonicalInductionVariable and a store in IVS.

That makes sense. We could then also add the assert back.

I pre-approve such a change.

Tobi




More information about the llvm-commits mailing list