[llvm] 80c34f9 - [InstCombine] Add test for PR44529; NFC
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 14:04:14 PST 2020
Author: Nikita Popov
Date: 2020-01-22T23:03:58+01:00
New Revision: 80c34f94acdbcbd8b02f61d89b100ff24ac39496
URL: https://github.com/llvm/llvm-project/commit/80c34f94acdbcbd8b02f61d89b100ff24ac39496
DIFF: https://github.com/llvm/llvm-project/commit/80c34f94acdbcbd8b02f61d89b100ff24ac39496.diff
LOG: [InstCombine] Add test for PR44529; NFC
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 1ab24c6d6deb..5ad23a4de582 100644
--- a/llvm/test/Transforms/InstCombine/sub.ll
+++ b/llvm/test/Transforms/InstCombine/sub.ll
@@ -541,6 +541,49 @@ define i32 @test26(i32 %x) {
ret i32 %neg
}
+define i64 @test_neg_shl_sub(i64 %a, i64 %b) {
+; CHECK-LABEL: @test_neg_shl_sub(
+; CHECK-NEXT: [[SUB:%.*]] = sub i64 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[MUL:%.*]] = shl i64 [[SUB]], 2
+; CHECK-NEXT: [[NEG:%.*]] = sub i64 0, [[MUL]]
+; CHECK-NEXT: ret i64 [[NEG]]
+;
+ %sub = sub i64 %a, %b
+ %mul = shl i64 %sub, 2
+ %neg = sub i64 0, %mul
+ ret i64 %neg
+}
+
+define i64 @test_neg_shl_sub_extra_use1(i64 %a, i64 %b, i64* %p) {
+; CHECK-LABEL: @test_neg_shl_sub_extra_use1(
+; CHECK-NEXT: [[SUB:%.*]] = sub i64 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: store i64 [[SUB]], i64* [[P:%.*]], align 8
+; CHECK-NEXT: [[MUL:%.*]] = shl i64 [[SUB]], 2
+; CHECK-NEXT: [[NEG:%.*]] = sub i64 0, [[MUL]]
+; CHECK-NEXT: ret i64 [[NEG]]
+;
+ %sub = sub i64 %a, %b
+ store i64 %sub, i64* %p
+ %mul = shl i64 %sub, 2
+ %neg = sub i64 0, %mul
+ ret i64 %neg
+}
+
+define i64 @test_neg_shl_sub_extra_use2(i64 %a, i64 %b, i64* %p) {
+; CHECK-LABEL: @test_neg_shl_sub_extra_use2(
+; CHECK-NEXT: [[SUB:%.*]] = sub i64 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[MUL:%.*]] = shl i64 [[SUB]], 2
+; CHECK-NEXT: store i64 [[MUL]], i64* [[P:%.*]], align 8
+; CHECK-NEXT: [[NEG:%.*]] = sub i64 0, [[MUL]]
+; CHECK-NEXT: ret i64 [[NEG]]
+;
+ %sub = sub i64 %a, %b
+ %mul = shl i64 %sub, 2
+ store i64 %mul, i64* %p
+ %neg = sub i64 0, %mul
+ ret i64 %neg
+}
+
define i32 @test27(i32 %x, i32 %y) {
; CHECK-LABEL: @test27(
; CHECK-NEXT: [[TMP1:%.*]] = shl i32 [[Y:%.*]], 3
More information about the llvm-commits
mailing list