[PATCH] D35256: [SCEV] Try harder to preserve NSW information for sext(sub) expressions

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 11:46:35 PDT 2017


sanjoy added inline comments.


================
Comment at: test/Analysis/ScalarEvolution/flags-from-poison.ll:612
 ; CHECK: %index64 =
-; CHECK: --> {(sext i32 (-1 * %sub) to i64),+,1}<nsw>
+; CHECK: --> {(-1 * (sext i32 %sub to i64))<nsw>,+,1}<nsw
   %index64 = sext i32 %index32 to i64
----------------
aemerson wrote:
> sanjoy wrote:
> > Please add a test case that uses `Intrinsic::ssub_with_overflow`. 
> I see the code in MatchBinaryOperator doesn't seem to check for guard edges of the `ssub_with_overflow` intrinsic's overflow return value like it does for `sadd_with_overflow`. Is there a reason why it doesn't do that, if not I'll go and add support for it.
> 
> Without that modification it looks like intrinsic test case won't work.
> Is there a reason why it doesn't do that, if not I'll go and add support for it.

I don't think there was any reason beyond that that code would not be exercised (but this patch changes that); please go ahead with the implementation.


Repository:
  rL LLVM

https://reviews.llvm.org/D35256





More information about the llvm-commits mailing list