[llvm-branch-commits] [llvm] 3c60e9b - Add tests for D93943 (NFC)
Juneyoung Lee via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 31 13:04:18 PST 2020
Author: Juneyoung Lee
Date: 2021-01-01T05:59:52+09:00
New Revision: 3c60e9bac86804a32bf515b9381c91fb64d769f8
URL: https://github.com/llvm/llvm-project/commit/3c60e9bac86804a32bf515b9381c91fb64d769f8
DIFF: https://github.com/llvm/llvm-project/commit/3c60e9bac86804a32bf515b9381c91fb64d769f8.diff
LOG: Add tests for D93943 (NFC)
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/switch_create.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/switch_create.ll b/llvm/test/Transforms/SimplifyCFG/switch_create.ll
index cc7a48904482..10689a03c398 100644
--- a/llvm/test/Transforms/SimplifyCFG/switch_create.ll
+++ b/llvm/test/Transforms/SimplifyCFG/switch_create.ll
@@ -469,6 +469,29 @@ define i32 @test10_select(i32 %mode, i1 %Cond) {
; CHECK-NEXT: [[A:%.*]] = icmp ne i32 [[MODE:%.*]], 0
; CHECK-NEXT: [[B:%.*]] = icmp ne i32 [[MODE]], 51
; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], i1 [[B]], i1 false
+; CHECK-NEXT: [[D:%.*]] = select i1 [[C]], i1 [[COND:%.*]], i1 false
+; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[D]], i32 123, i32 324
+; CHECK-NEXT: ret i32 [[SPEC_SELECT]]
+;
+ %A = icmp ne i32 %mode, 0
+ %B = icmp ne i32 %mode, 51
+ %C = select i1 %A, i1 %B, i1 false
+ %D = select i1 %C, i1 %Cond, i1 false
+ br i1 %D, label %T, label %F
+T:
+ ret i32 123
+F:
+ ret i32 324
+
+}
+
+; TODO: %Cond doesn't need freeze
+define i32 @test10_select_and(i32 %mode, i1 %Cond) {
+; CHECK-LABEL: @test10_select_and(
+; CHECK-NEXT: T:
+; CHECK-NEXT: [[A:%.*]] = icmp ne i32 [[MODE:%.*]], 0
+; CHECK-NEXT: [[B:%.*]] = icmp ne i32 [[MODE]], 51
+; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], i1 [[B]], i1 false
; CHECK-NEXT: [[D:%.*]] = and i1 [[C]], [[COND:%.*]]
; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[D]], i32 123, i32 324
; CHECK-NEXT: ret i32 [[SPEC_SELECT]]
@@ -485,6 +508,28 @@ F:
}
+define i32 @test10_select_nofreeze(i32 %mode, i1 noundef %Cond) {
+; CHECK-LABEL: @test10_select_nofreeze(
+; CHECK-NEXT: T:
+; CHECK-NEXT: [[A:%.*]] = icmp ne i32 [[MODE:%.*]], 0
+; CHECK-NEXT: [[B:%.*]] = icmp ne i32 [[MODE]], 51
+; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], i1 [[B]], i1 false
+; CHECK-NEXT: [[D:%.*]] = select i1 [[C]], i1 [[COND:%.*]], i1 false
+; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[D]], i32 123, i32 324
+; CHECK-NEXT: ret i32 [[SPEC_SELECT]]
+;
+ %A = icmp ne i32 %mode, 0
+ %B = icmp ne i32 %mode, 51
+ %C = select i1 %A, i1 %B, i1 false
+ %D = select i1 %C, i1 %Cond, i1 false
+ br i1 %D, label %T, label %F
+T:
+ ret i32 123
+F:
+ ret i32 324
+
+}
+
; PR8780
define i32 @test11(i32 %bar) nounwind {
; CHECK-LABEL: @test11(
More information about the llvm-branch-commits
mailing list