Hi,<div><br></div><div>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.</div><div><br></div>
<div>Thanks for the ideas about other approaches.</div><div><br></div><div>Preston</div><div><br><br><div class="gmail_quote">On Sun, Jun 17, 2012 at 8:03 PM, Nuno Lopes <span dir="ltr"><<a href="mailto:nunoplopes@sapo.pt" target="_blank">nunoplopes@sapo.pt</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
So SCEV cannot simplify that expression to -1 because of overflow issues (take e.g. src=0x7FFF..).<br>
If you compile with 64 bits integers, then the sexts disappear and so SCEV can do the simplification.<br>
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::<u></u>SimplifyICmpOperands().<span class="HOEnZb"><font color="#888888"><br>

<br>
Nuno</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
-----Original Message-----<br>
From: Preston Briggs<br>
Sent: Saturday, June 16, 2012 3:52 AM<br>
To: LLVM Developers Mailing List<br>
Subject: [LLVMdev] SCEV not simplifying<br>
<br>
<br>
I have a pair of SCEVs that appear different to me.<br>
However, when I compute the difference, it's not known to be non-zero.<br>
<br>
   src = (sext i32 %n to i64)<br>
   dst = (sext i32 (1 + %n) to i64)<br>
   delta = ((sext i32 %n to i64) + (-1 * (sext i32 (1 + %n) to i64)))<br>
<br>
Is this behavior expected?<br>
<br>
If I repeat the experiment with 64-bit ints (or unsigned),<br>
things work out like I expect. 32-bit unsigned is also bad.<br>
<br>
Thanks,<br>
Preston <br>
</div></div></blockquote></div><br></div>