[PATCH] D16908: Add a test case to show isKnownNonZero() returns correctly; NFC
Jun Bum Lim via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 08:03:20 PST 2016
junbuml retitled this revision from "[ValueTracking] Use Constant::isZeroValue() in isKnownZero()" to "Add a test case to show isKnownNonZero() returns correctly; NFC".
junbuml updated the summary for this revision.
junbuml updated this revision to Diff 47648.
junbuml added a comment.
Based on Nick's comment, I just added a test case to prevent any similar changes in future.
Thanks Nick for the comment.
http://reviews.llvm.org/D16908
Files:
test/Transforms/InstSimplify/compare.ll
Index: test/Transforms/InstSimplify/compare.ll
===================================================================
--- test/Transforms/InstSimplify/compare.ll
+++ test/Transforms/InstSimplify/compare.ll
@@ -333,6 +333,21 @@
; CHECK: ret i1 false
}
+; Do not expect to simplify if we cannot guarantee that
+; the ConstantExpr is a non-zero constant.
+ at GV = common global i32* null
+define i1 @or_constexp(i32 %x) {
+; CHECK-LABEL: @or_constexp(
+entry:
+ %0 = and i32 ptrtoint (i32** @GV to i32), 32
+ %o = or i32 %x, %0
+ %c = icmp eq i32 %o, 0
+ ret i1 %c
+; CHECK: or
+; CHECK-NEXT: icmp eq
+; CHECK-NOT: ret i1 false
+}
+
define i1 @shl1(i32 %x) {
; CHECK-LABEL: @shl1(
%s = shl i32 1, %x
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16908.47648.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160211/7b36254a/attachment.bin>
More information about the llvm-commits
mailing list