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

Sebastian Pop spop at codeaurora.org
Thu Mar 21 12:53:45 PDT 2013


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.

Thanks,
Sebastian
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation



More information about the llvm-commits mailing list