[llvm] r304474 - [InstSimplify][ConstantFolding] Add test demonstrating failure to simplify (icmp eq null, inttoptr x) when the null is on the left hand side. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 14:20:08 PDT 2017


Author: ctopper
Date: Thu Jun  1 16:20:07 2017
New Revision: 304474

URL: http://llvm.org/viewvc/llvm-project?rev=304474&view=rev
Log:
[InstSimplify][ConstantFolding] Add test demonstrating failure to simplify (icmp eq null, inttoptr x) when the null is on the left hand side. NFC

Modified:
    llvm/trunk/test/Transforms/InstSimplify/compare.ll

Modified: llvm/trunk/test/Transforms/InstSimplify/compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/compare.ll?rev=304474&r1=304473&r2=304474&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/compare.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/compare.ll Thu Jun  1 16:20:07 2017
@@ -1278,3 +1278,19 @@ define void @icmp_slt_sge_or(i32 %Ax, i3
 ; CHECK: call void @helper_i1(i1 true)
   ret void
 }
+
+define i1 @constant_fold_inttoptr_null() {
+; CHECK-LABEL: @constant_fold_inttoptr_null(
+; CHECK-NEXT:    ret i1 false
+;
+  %x = icmp eq i32* inttoptr (i64 32 to i32*), null
+  ret i1 %x
+}
+
+define i1 @constant_fold_null_inttoptr() {
+; CHECK-LABEL: @constant_fold_null_inttoptr(
+; CHECK-NEXT:    ret i1 icmp eq (i32* inttoptr (i64 32 to i32*), i32* null)
+;
+  %x = icmp eq i32* null, inttoptr (i64 32 to i32*)
+  ret i1 %x
+}




More information about the llvm-commits mailing list