[LLVMdev] ScalarEvolution Patch

Dan Gohman gohman at apple.com
Fri Feb 22 12:50:00 PST 2008


That patch looks right to me, though I think you can change
the <= to <, because an addrec won't be invariant in its own
loop. Also, there is similar code in getMulExpr to which this
also applies.

Do you happen to have a testcase affected by this?

Dan

On Feb 22, 2008, at 9:05 AM, John Criswell wrote:

> Dear All,
>
> Is the following patch to ScalarEvolution correct?  It seems that  
> without it, the enclosing for loop could skip over SCEVAddRecExpr's  
> in the Ops[] array.
>
> -- John T.
>
> Index: ScalarEvolution.cpp
> ===================================================================
> --- ScalarEvolution.cpp	(revision 47480)
> +++ ScalarEvolution.cpp	(working copy)
> @@ -865,6 +865,7 @@
>       if (Ops[i]->isLoopInvariant(AddRec->getLoop())) {
>         LIOps.push_back(Ops[i]);
>         Ops.erase(Ops.begin()+i);
> +        if (i <= Idx) --Idx;
>         --i; --e;
>       }
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list