[llvm] 521205c - [Test] Add pointer comparison test that crashed with D118317

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 19:13:13 PST 2022


Author: Max Kazantsev
Date: 2022-01-29T10:13:00+07:00
New Revision: 521205c084f48607375d696465fd73f5728a9def

URL: https://github.com/llvm/llvm-project/commit/521205c084f48607375d696465fd73f5728a9def
DIFF: https://github.com/llvm/llvm-project/commit/521205c084f48607375d696465fd73f5728a9def.diff

LOG: [Test] Add pointer comparison test that crashed with D118317

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/icmp-vec.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp-vec.ll b/llvm/test/Transforms/InstCombine/icmp-vec.ll
index 8c90fd3ae89e..3068c1b5dcff 100644
--- a/llvm/test/Transforms/InstCombine/icmp-vec.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-vec.ll
@@ -712,3 +712,29 @@ define i1 @eq_cast_zext_use2(<5 x i3> %b) {
   %r = icmp eq i35 %bc, 0
   ret i1 %r
 }
+
+define i1 @eq_cast_eq_ptr-1(<2 x i4*> %x, <2 x i4*> %y) {
+; CHECK-LABEL: @eq_cast_eq_ptr-1(
+; CHECK-NEXT:    [[IC:%.*]] = icmp ne <2 x i4*> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[TMP1:%.*]] = bitcast <2 x i1> [[IC]] to i2
+; CHECK-NEXT:    [[R:%.*]] = icmp eq i2 [[TMP1]], 0
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %ic = icmp eq <2 x i4*> %x, %y
+  %b = bitcast <2 x i1> %ic to i2
+  %r = icmp eq i2 %b, -1
+  ret i1 %r
+}
+
+define i1 @eq_cast_ne_ptr-1(<2 x i4*> %x, <2 x i4*> %y) {
+; CHECK-LABEL: @eq_cast_ne_ptr-1(
+; CHECK-NEXT:    [[IC:%.*]] = icmp ne <2 x i4*> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[TMP1:%.*]] = bitcast <2 x i1> [[IC]] to i2
+; CHECK-NEXT:    [[R:%.*]] = icmp ne i2 [[TMP1]], 0
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %ic = icmp eq <2 x i4*> %x, %y
+  %b = bitcast <2 x i1> %ic to i2
+  %r = icmp ne i2 %b, -1
+  ret i1 %r
+}


        


More information about the llvm-commits mailing list