[llvm] cb44439 - [SimplifyCFG] Make test more robust (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 4 08:15:11 PDT 2021
Author: Nikita Popov
Date: 2021-04-04T17:14:59+02:00
New Revision: cb4443994e72ab524c70854dc93cd272ac1c4026
URL: https://github.com/llvm/llvm-project/commit/cb4443994e72ab524c70854dc93cd272ac1c4026
DIFF: https://github.com/llvm/llvm-project/commit/cb4443994e72ab524c70854dc93cd272ac1c4026.diff
LOG: [SimplifyCFG] Make test more robust (NFC)
These are supposed to test creation of a switch, so make sure
there is some actual code in the branches. Otherwise this could
be turned into a select instead.
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
llvm/test/Transforms/SimplifyCFG/switch_create.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll b/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
index e5c12cbc56f76..91e8b3d84942d 100644
--- a/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
+++ b/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
@@ -253,7 +253,7 @@ define void @test7(i8 zeroext %c, i32 %x) nounwind ssp noredzone {
; CHECK-NEXT: i8 97, label [[IF_THEN]]
; CHECK-NEXT: ]
; CHECK: if.then:
-; CHECK-NEXT: tail call void @foo1() [[ATTR2:#.*]]
+; CHECK-NEXT: tail call void @foo1() #[[ATTR2:[0-9]+]]
; CHECK-NEXT: ret void
; CHECK: if.end:
; CHECK-NEXT: ret void
@@ -289,7 +289,7 @@ define i32 @test8(i8 zeroext %c, i32 %x, i1 %C) nounwind ssp noredzone {
; CHECK-NEXT: ]
; CHECK: if.then:
; CHECK-NEXT: [[A:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 42, [[SWITCH_EARLY_TEST]] ], [ 42, [[N]] ], [ 42, [[SWITCH_EARLY_TEST]] ]
-; CHECK-NEXT: tail call void @foo1() [[ATTR2]]
+; CHECK-NEXT: tail call void @foo1() #[[ATTR2]]
; CHECK-NEXT: ret i32 [[A]]
; CHECK: if.end:
; CHECK-NEXT: ret i32 0
@@ -396,10 +396,11 @@ define i32 @test10(i32 %mode, i1 %Cond) {
; CHECK-NEXT: i32 0, label [[F]]
; CHECK-NEXT: ]
; CHECK: T:
-; CHECK-NEXT: [[MERGE:%.*]] = phi i32 [ 123, [[SWITCH_EARLY_TEST]] ], [ 324, [[F]] ]
-; CHECK-NEXT: ret i32 [[MERGE]]
+; CHECK-NEXT: call void @foo1()
+; CHECK-NEXT: ret i32 123
; CHECK: F:
-; CHECK-NEXT: br label [[T]]
+; CHECK-NEXT: call void @foo2()
+; CHECK-NEXT: ret i32 324
;
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
@@ -407,8 +408,10 @@ define i32 @test10(i32 %mode, i1 %Cond) {
%D = and i1 %C, %Cond
br i1 %D, label %T, label %F
T:
+ call void @foo1()
ret i32 123
F:
+ call void @foo2()
ret i32 324
}
@@ -506,7 +509,7 @@ define void @test13(i32 %x) nounwind ssp noredzone {
; CHECK-NEXT: i32 0, label [[IF_THEN]]
; CHECK-NEXT: ]
; CHECK: if.then:
-; CHECK-NEXT: call void @foo1() [[ATTR3:#.*]]
+; CHECK-NEXT: call void @foo1() #[[ATTR3:[0-9]+]]
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: ret void
@@ -548,7 +551,7 @@ define void @test14(i32 %x) nounwind ssp noredzone {
; CHECK-NEXT: i32 0, label [[IF_THEN]]
; CHECK-NEXT: ]
; CHECK: if.then:
-; CHECK-NEXT: call void @foo1() [[ATTR3]]
+; CHECK-NEXT: call void @foo1() #[[ATTR3]]
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: ret void
diff --git a/llvm/test/Transforms/SimplifyCFG/switch_create.ll b/llvm/test/Transforms/SimplifyCFG/switch_create.ll
index 3a047313b44a8..0ed254af2a26e 100644
--- a/llvm/test/Transforms/SimplifyCFG/switch_create.ll
+++ b/llvm/test/Transforms/SimplifyCFG/switch_create.ll
@@ -303,7 +303,7 @@ define void @test7(i8 zeroext %c, i32 %x) nounwind ssp noredzone {
; CHECK-NEXT: i8 97, label [[IF_THEN]]
; CHECK-NEXT: ]
; CHECK: if.then:
-; CHECK-NEXT: tail call void @foo1() [[ATTR2:#.*]]
+; CHECK-NEXT: tail call void @foo1() #[[ATTR2:[0-9]+]]
; CHECK-NEXT: ret void
; CHECK: if.end:
; CHECK-NEXT: ret void
@@ -339,7 +339,7 @@ define i32 @test8(i8 zeroext %c, i32 %x, i1 %C) nounwind ssp noredzone {
; CHECK-NEXT: ]
; CHECK: if.then:
; CHECK-NEXT: [[A:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 42, [[SWITCH_EARLY_TEST]] ], [ 42, [[N]] ], [ 42, [[SWITCH_EARLY_TEST]] ]
-; CHECK-NEXT: tail call void @foo1() [[ATTR2]]
+; CHECK-NEXT: tail call void @foo1() #[[ATTR2]]
; CHECK-NEXT: ret i32 [[A]]
; CHECK: if.end:
; CHECK-NEXT: ret i32 0
@@ -446,10 +446,11 @@ define i32 @test10(i32 %mode, i1 %Cond) {
; CHECK-NEXT: i32 0, label [[F]]
; CHECK-NEXT: ]
; CHECK: T:
-; CHECK-NEXT: [[MERGE:%.*]] = phi i32 [ 123, [[SWITCH_EARLY_TEST]] ], [ 324, [[F]] ]
-; CHECK-NEXT: ret i32 [[MERGE]]
+; CHECK-NEXT: call void @foo1()
+; CHECK-NEXT: ret i32 123
; CHECK: F:
-; CHECK-NEXT: br label [[T]]
+; CHECK-NEXT: call void @foo2()
+; CHECK-NEXT: ret i32 324
;
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
@@ -457,8 +458,10 @@ define i32 @test10(i32 %mode, i1 %Cond) {
%D = and i1 %C, %Cond
br i1 %D, label %T, label %F
T:
+ call void @foo1()
ret i32 123
F:
+ call void @foo2()
ret i32 324
}
@@ -472,10 +475,11 @@ define i32 @test10_select(i32 %mode, i1 %Cond) {
; CHECK-NEXT: i32 0, label [[F]]
; CHECK-NEXT: ]
; CHECK: T:
-; CHECK-NEXT: [[MERGE:%.*]] = phi i32 [ 123, [[SWITCH_EARLY_TEST]] ], [ 324, [[F]] ]
-; CHECK-NEXT: ret i32 [[MERGE]]
+; CHECK-NEXT: call void @foo1()
+; CHECK-NEXT: ret i32 123
; CHECK: F:
-; CHECK-NEXT: br label [[T]]
+; CHECK-NEXT: call void @foo2()
+; CHECK-NEXT: ret i32 324
;
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
@@ -483,8 +487,10 @@ define i32 @test10_select(i32 %mode, i1 %Cond) {
%D = select i1 %C, i1 %Cond, i1 false
br i1 %D, label %T, label %F
T:
+ call void @foo1()
ret i32 123
F:
+ call void @foo2()
ret i32 324
}
@@ -499,10 +505,11 @@ define i32 @test10_select_and(i32 %mode, i1 %Cond) {
; CHECK-NEXT: i32 0, label [[F]]
; CHECK-NEXT: ]
; CHECK: T:
-; CHECK-NEXT: [[MERGE:%.*]] = phi i32 [ 123, [[SWITCH_EARLY_TEST]] ], [ 324, [[F]] ]
-; CHECK-NEXT: ret i32 [[MERGE]]
+; CHECK-NEXT: call void @foo1()
+; CHECK-NEXT: ret i32 123
; CHECK: F:
-; CHECK-NEXT: br label [[T]]
+; CHECK-NEXT: call void @foo2()
+; CHECK-NEXT: ret i32 324
;
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
@@ -510,8 +517,10 @@ define i32 @test10_select_and(i32 %mode, i1 %Cond) {
%D = and i1 %C, %Cond
br i1 %D, label %T, label %F
T:
+ call void @foo1()
ret i32 123
F:
+ call void @foo2()
ret i32 324
}
@@ -525,10 +534,11 @@ define i32 @test10_select_nofreeze(i32 %mode, i1 noundef %Cond) {
; CHECK-NEXT: i32 0, label [[F]]
; CHECK-NEXT: ]
; CHECK: T:
-; CHECK-NEXT: [[MERGE:%.*]] = phi i32 [ 123, [[SWITCH_EARLY_TEST]] ], [ 324, [[F]] ]
-; CHECK-NEXT: ret i32 [[MERGE]]
+; CHECK-NEXT: call void @foo1()
+; CHECK-NEXT: ret i32 123
; CHECK: F:
-; CHECK-NEXT: br label [[T]]
+; CHECK-NEXT: call void @foo2()
+; CHECK-NEXT: ret i32 324
;
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
@@ -536,8 +546,10 @@ define i32 @test10_select_nofreeze(i32 %mode, i1 noundef %Cond) {
%D = select i1 %C, i1 %Cond, i1 false
br i1 %D, label %T, label %F
T:
+ call void @foo1()
ret i32 123
F:
+ call void @foo2()
ret i32 324
}
@@ -594,8 +606,8 @@ return: ; preds = %if.end, %if.then
define void @test12() nounwind {
; CHECK-LABEL: @test12(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DOTOLD:%.*]] = icmp eq i32 undef, undef
-; CHECK-NEXT: br i1 [[DOTOLD]], label [[BB55_US_US:%.*]], label [[MALFORMED:%.*]]
+; CHECK-NEXT: [[A_OLD:%.*]] = icmp eq i32 undef, undef
+; CHECK-NEXT: br i1 [[A_OLD]], label [[BB55_US_US:%.*]], label [[MALFORMED:%.*]]
; CHECK: bb55.us.us:
; CHECK-NEXT: [[B:%.*]] = icmp ugt i32 undef, undef
; CHECK-NEXT: [[A:%.*]] = icmp eq i32 undef, undef
@@ -635,7 +647,7 @@ define void @test13(i32 %x) nounwind ssp noredzone {
; CHECK-NEXT: i32 0, label [[IF_THEN]]
; CHECK-NEXT: ]
; CHECK: if.then:
-; CHECK-NEXT: call void @foo1() [[ATTR3:#.*]]
+; CHECK-NEXT: call void @foo1() #[[ATTR3:[0-9]+]]
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: ret void
@@ -677,7 +689,7 @@ define void @test14(i32 %x) nounwind ssp noredzone {
; CHECK-NEXT: i32 0, label [[IF_THEN]]
; CHECK-NEXT: ]
; CHECK: if.then:
-; CHECK-NEXT: call void @foo1() [[ATTR3]]
+; CHECK-NEXT: call void @foo1() #[[ATTR3]]
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: ret void
More information about the llvm-commits
mailing list