[LLVMdev] SCEV getMulExpr() not propagating Wrap flags

Renato Golin renato.golin at linaro.org
Sat Nov 16 04:11:06 PST 2013


On 16 November 2013 06:56, Andrew Trick <atrick at apple.com> wrote:

> - getMulExpr constructs a new AddRec with NSW:
>
>       Flags = AddRec->getNoWrapFlags(clearFlags(Flags, SCEV::FlagNW));
>       const SCEV *NewRec = getAddRecExpr(NewOps, AddRecLoop, Flags);
>

Hi Andrew,

Thanks for looking at this.

Clearing the flags here makes sense, but it's being too conservative. I'm
thinking I'll need something like propagateSafeFlags(...) with knowledge of
the loop induction ranges or something else instead of simply relying on
later processes to spot the problems.


The clearing of NW does not need to happen in your case (NSW/NUW should
> always imply NW). You could try this and see if it fixes the problem:
>
>       Flags = AddRec->getNoWrapFlags();
>
> If that fixes your case, then the right/safe fix will be trivial.
>

It does, on that case. Shouldn't be too hard, but having the right info on
the right place could be tricky.

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131116/76c06e78/attachment.html>


More information about the llvm-dev mailing list