[llvm] f241d43 - [NFC][ InstCombine] precommit test for D121585
Andrew Wei via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 09:38:34 PDT 2022
Author: Andrew Wei
Date: 2022-03-18T00:37:21+08:00
New Revision: f241d43b4003710f0a8edf312886e09a2f70a051
URL: https://github.com/llvm/llvm-project/commit/f241d43b4003710f0a8edf312886e09a2f70a051
DIFF: https://github.com/llvm/llvm-project/commit/f241d43b4003710f0a8edf312886e09a2f70a051.diff
LOG: [NFC][ InstCombine] precommit test for D121585
Based on original tests from D121585.
Added:
Modified:
llvm/test/Transforms/InstCombine/sink_instruction.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/sink_instruction.ll b/llvm/test/Transforms/InstCombine/sink_instruction.ll
index a631af2d8a75b..fb40a9c5f2a7c 100644
--- a/llvm/test/Transforms/InstCombine/sink_instruction.ll
+++ b/llvm/test/Transforms/InstCombine/sink_instruction.ll
@@ -237,3 +237,35 @@ if:
else:
ret void
}
+
+declare void @abort()
+declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64)
+declare void @dummy(i64)
+; Todo: Two uses in two
diff erent users of a single successor block. We can sink.
+define i64 @test8(i64 %c) {
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: bb1:
+; CHECK-NEXT: [[OVERFLOW:%.*]] = icmp ugt i64 [[C:%.*]], 2305843009213693951
+; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[OVERFLOW]], i64 0, i64 8
+; CHECK-NEXT: br i1 [[OVERFLOW]], label [[ABORT:%.*]], label [[BB2:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: call void @dummy(i64 [[SELECT]])
+; CHECK-NEXT: ret i64 [[SELECT]]
+; CHECK: abort:
+; CHECK-NEXT: call void @abort()
+; CHECK-NEXT: unreachable
+;
+bb1:
+ %mul = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %c, i64 8)
+ %overflow = extractvalue { i64, i1 } %mul, 1
+ %select = select i1 %overflow, i64 0, i64 8
+ br i1 %overflow, label %abort, label %bb2
+
+bb2:
+ call void @dummy(i64 %select)
+ ret i64 %select
+
+abort:
+ call void @abort()
+ unreachable
+}
More information about the llvm-commits
mailing list