[LLVMdev] SCEV not simplifying

Preston Briggs preston.briggs at gmail.com
Mon Jun 18 10:52:26 PDT 2012


Hi,

I don't mind the expression not being simplified (incorrectly!) to -1, but
I was hoping that the package would be clever enough to recognize that the
expression wasn't zero.

Thanks for the ideas about other approaches.

Preston


On Sun, Jun 17, 2012 at 8:03 PM, Nuno Lopes <nunoplopes at sapo.pt> wrote:

> Hi,
>
> So SCEV cannot simplify that expression to -1 because of overflow issues
> (take e.g. src=0x7FFF..).
> If you compile with 64 bits integers, then the sexts disappear and so SCEV
> can do the simplification.
> Depending on what you want to do, you may want to either do not extend src
> and dst to 64 bits or add a NSW flag to the computations. That will
> hopefully make SCEV push the sext outside and then perform the
> simplification. You can also take a look at ScalarEvolution::**
> SimplifyICmpOperands().
>
> Nuno
>
>
>
> -----Original Message-----
> From: Preston Briggs
> Sent: Saturday, June 16, 2012 3:52 AM
> To: LLVM Developers Mailing List
> Subject: [LLVMdev] SCEV not simplifying
>
>
> I have a pair of SCEVs that appear different to me.
> However, when I compute the difference, it's not known to be non-zero.
>
>   src = (sext i32 %n to i64)
>   dst = (sext i32 (1 + %n) to i64)
>   delta = ((sext i32 %n to i64) + (-1 * (sext i32 (1 + %n) to i64)))
>
> Is this behavior expected?
>
> If I repeat the experiment with 64-bit ints (or unsigned),
> things work out like I expect. 32-bit unsigned is also bad.
>
> Thanks,
> Preston
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120618/12f6fc25/attachment.html>


More information about the llvm-dev mailing list