[llvm] d0518a2 - [GVN] add another commutable intrinsic test; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 15:37:34 PDT 2020


Author: Sanjay Patel
Date: 2020-08-30T18:36:28-04:00
New Revision: d0518a2be31cba051c4b81b140ef73aa1f1a78af

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

LOG: [GVN] add another commutable intrinsic test; NFC

This is a reduced version of a test-suite crasher with rG25597f7

Added: 
    

Modified: 
    llvm/test/Transforms/GVN/commute.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/GVN/commute.ll b/llvm/test/Transforms/GVN/commute.ll
index 4fb4f99a27fc..2e6d7274ead9 100644
--- a/llvm/test/Transforms/GVN/commute.ll
+++ b/llvm/test/Transforms/GVN/commute.ll
@@ -29,6 +29,8 @@ define void @cmp(i32 %x, i32 %y) {
   ret void
 }
 
+declare i32 @llvm.umax.i32(i32, i32)
+
 define void @intrinsic(i32 %x, i32 %y) {
 ; CHECK-LABEL: @intrinsic(
 ; CHECK-NEXT:    [[M1:%.*]] = call i32 @llvm.umax.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
@@ -42,4 +44,27 @@ define void @intrinsic(i32 %x, i32 %y) {
   ret void
 }
 
-declare i32 @llvm.umax.i32(i32, i32)
+declare { i32, i1 } @llvm.umul.with.overflow.i32(i32, i32)
+
+define { i32, i1 } @intrinsic2(i32 %x, i32 %y, i1 %cond) {
+; CHECK-LABEL: @intrinsic2(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br i1 [[COND:%.*]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
+; CHECK:       if.then:
+; CHECK-NEXT:    unreachable
+; CHECK:       if.end:
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 0, [[Y:%.*]]
+; CHECK-NEXT:    [[UMUL:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[X:%.*]], i32 [[Y]])
+; CHECK-NEXT:    ret { i32, i1 } [[UMUL]]
+;
+entry:
+  br i1 %cond, label %if.then, label %if.end
+
+if.then:
+  unreachable
+
+if.end:
+  %cmp = icmp eq i32 0, %y
+  %umul = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %x, i32 %y)
+  ret { i32, i1 } %umul
+}


        


More information about the llvm-commits mailing list