[llvm] 7872074 - [InstCombine] Add reduced sub/negate test from PR51584.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 07:47:55 PDT 2021


Author: Florian Hahn
Date: 2021-08-23T15:47:22+01:00
New Revision: 7872074f226426530bccbeb6d3ab7fbddf18041b

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

LOG: [InstCombine] Add reduced sub/negate test from PR51584.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/sub.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/sub.ll b/llvm/test/Transforms/InstCombine/sub.ll
index e228ac84c47c..878061b9296e 100644
--- a/llvm/test/Transforms/InstCombine/sub.ll
+++ b/llvm/test/Transforms/InstCombine/sub.ll
@@ -1700,3 +1700,15 @@ define <2 x i8> @or_vec(<2 x i8> %X, <2 x i8> %Y) {
   %r = sub <2 x i8> %a, %b
   ret <2 x i8> %r
 }
+
+define i32 @pr51584(i32 %a, i32 %b) {
+; CHECK-LABEL: @pr51584(
+; CHECK-NEXT:    [[TMP1:%.*]] = add i32 [[B:%.*]], [[A:%.*]]
+; CHECK-NEXT:    [[DOTNEG:%.*]] = sub i32 -11, [[TMP1]]
+; CHECK-NEXT:    ret i32 [[DOTNEG]]
+;
+  %sub = sub i32 0, %a
+  %add = add nsw i32 11, %b
+  %sub1 = sub i32 %sub, %add
+  ret i32 %sub1
+}


        


More information about the llvm-commits mailing list