[llvm] 482d653 - [NFC][InstCombine] Add test coverage for PR47997

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 05:07:14 PST 2020


Author: Roman Lebedev
Date: 2020-11-03T16:06:50+03:00
New Revision: 482d65331bab5f007408ad573f8b613d6adcf4f3

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

LOG: [NFC][InstCombine] Add test coverage for PR47997

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 80dd9d2b523d..27b85aae180f 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -3821,3 +3821,26 @@ define i1 @signbit_bitcast_fptrunc_ppc_fp128(ppc_fp128 %x) {
   %s4 = icmp slt i32 %s3, 0
   ret i1 %s4
 }
+
+ at x = external dso_local local_unnamed_addr global i32, align 4
+ at y = external dso_local local_unnamed_addr global i32, align 4
+define i1 @pr47997(i32 %arg) {
+; CHECK-LABEL: @pr47997(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:    [[I:%.*]] = add nsw i32 [[ARG:%.*]], -1
+; CHECK-NEXT:    store i32 [[I]], i32* @x, align 4
+; CHECK-NEXT:    [[I1:%.*]] = sub nsw i32 1, [[ARG]]
+; CHECK-NEXT:    store i32 [[I1]], i32* @y, align 4
+; CHECK-NEXT:    [[I2:%.*]] = sub nsw i32 0, [[I1]]
+; CHECK-NEXT:    [[I3:%.*]] = icmp eq i32 [[I]], [[I2]]
+; CHECK-NEXT:    ret i1 [[I3]]
+;
+bb:
+  %i = add nsw i32 %arg, -1
+  store i32 %i, i32* @x
+  %i1 = sub nsw i32 1, %arg
+  store i32 %i1, i32* @y
+  %i2 = sub nsw i32 0, %i1
+  %i3 = icmp eq i32 %i, %i2
+  ret i1 %i3
+}


        


More information about the llvm-commits mailing list