[llvm] e5e844b - [NFC] Pre-commit test for InstSimplify phi(poison)
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 30 04:37:35 PST 2021
Author: Nuno Lopes
Date: 2021-12-30T12:37:20Z
New Revision: e5e844b37e75efb5528b8b410f1590bf2c913bc7
URL: https://github.com/llvm/llvm-project/commit/e5e844b37e75efb5528b8b410f1590bf2c913bc7
DIFF: https://github.com/llvm/llvm-project/commit/e5e844b37e75efb5528b8b410f1590bf2c913bc7.diff
LOG: [NFC] Pre-commit test for InstSimplify phi(poison)
Added:
Modified:
llvm/test/Transforms/InstSimplify/phi.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/phi.ll b/llvm/test/Transforms/InstSimplify/phi.ll
index 2861cca64ffeb..e75a1f95273f5 100644
--- a/llvm/test/Transforms/InstSimplify/phi.ll
+++ b/llvm/test/Transforms/InstSimplify/phi.ll
@@ -72,3 +72,83 @@ EXIT:
%w = phi i32 [%v, %A], [poison, %B]
ret i32 %w
}
+
+define i32 @undef(i1 %cond, i32 %v) {
+; CHECK-LABEL: @undef(
+; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
+; CHECK: A:
+; CHECK-NEXT: br label [[EXIT:%.*]]
+; CHECK: B:
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: EXIT:
+; CHECK-NEXT: ret i32 [[V:%.*]]
+;
+ br i1 %cond, label %A, label %B
+A:
+ br label %EXIT
+B:
+ br label %EXIT
+EXIT:
+ %w = phi i32 [%v, %A], [undef, %B]
+ ret i32 %w
+}
+
+define i8 @undef_poison(i1 %cond) {
+; CHECK-LABEL: @undef_poison(
+; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
+; CHECK: A:
+; CHECK-NEXT: br label [[EXIT:%.*]]
+; CHECK: B:
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: EXIT:
+; CHECK-NEXT: ret i8 undef
+;
+ br i1 %cond, label %A, label %B
+A:
+ br label %EXIT
+B:
+ br label %EXIT
+EXIT:
+ %r = phi i8 [undef, %A], [poison, %B]
+ ret i8 %r
+}
+
+define i8 @only_undef(i1 %cond) {
+; CHECK-LABEL: @only_undef(
+; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
+; CHECK: A:
+; CHECK-NEXT: br label [[EXIT:%.*]]
+; CHECK: B:
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: EXIT:
+; CHECK-NEXT: ret i8 undef
+;
+ br i1 %cond, label %A, label %B
+A:
+ br label %EXIT
+B:
+ br label %EXIT
+EXIT:
+ %r = phi i8 [undef, %A], [undef, %B]
+ ret i8 %r
+}
+
+define i8 @only_poison(i1 %cond) {
+; CHECK-LABEL: @only_poison(
+; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
+; CHECK: A:
+; CHECK-NEXT: br label [[EXIT:%.*]]
+; CHECK: B:
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: EXIT:
+; CHECK-NEXT: ret i8 undef
+;
+ br i1 %cond, label %A, label %B
+A:
+ br label %EXIT
+B:
+ br label %EXIT
+EXIT:
+ %r = phi i8 [poison, %A], [poison, %B]
+ ret i8 %r
+}
More information about the llvm-commits
mailing list