[SCCP] Regenerate test checks (NFC)

This commit is contained in:
Nikita Popov 2022-06-03 14:27:20 +02:00
parent 166f9be330
commit 6baf44c8b1
3 changed files with 70 additions and 32 deletions

View File

@ -1,12 +1,19 @@
; RUN: opt < %s -passes=sccp -S | grep "ret i32 %X"
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=sccp -S | FileCheck %s
; This function definitely returns 1, even if we don't know the direction
; of the branch.
define i32 @foo() {
br i1 undef, label %T, label %T
T: ; preds = %0, %0
%X = add i32 0, 1 ; <i32> [#uses=1]
ret i32 %X
; CHECK-LABEL: @foo(
; CHECK-NEXT: br i1 false, label [[T:%.*]], label [[T]]
; CHECK: T:
; CHECK-NEXT: [[X:%.*]] = add i32 0, 1
; CHECK-NEXT: ret i32 [[X]]
;
br i1 undef, label %T, label %T
T:
%X = add i32 0, 1
ret i32 %X
}

View File

@ -1,36 +1,60 @@
; RUN: opt < %s -passes=sccp -S | grep undef | count 1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=sccp -S | FileCheck %s
; PR1938
define i32 @main() {
; CHECK-LABEL: @main(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[K:%.*]], [[BB_BACKEDGE:%.*]] ]
; CHECK-NEXT: [[K]] = add i32 [[INDVAR]], 1
; CHECK-NEXT: br i1 false, label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
; CHECK: cond_true:
; CHECK-NEXT: br i1 undef, label [[BB_BACKEDGE]], label [[BB12:%.*]]
; CHECK: bb.backedge:
; CHECK-NEXT: br label [[BB]]
; CHECK: cond_false:
; CHECK-NEXT: [[TMP9:%.*]] = icmp slt i32 [[K]], 10
; CHECK-NEXT: br i1 [[TMP9]], label [[BB_BACKEDGE]], label [[BB12]]
; CHECK: bb12:
; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i32 [[K]], 10
; CHECK-NEXT: br i1 [[TMP14]], label [[COND_NEXT18:%.*]], label [[COND_TRUE17:%.*]]
; CHECK: cond_true17:
; CHECK-NEXT: tail call void @abort()
; CHECK-NEXT: unreachable
; CHECK: cond_next18:
; CHECK-NEXT: ret i32 0
;
entry:
br label %bb
br label %bb
bb:
%indvar = phi i32 [ 0, %entry ], [ %k, %bb.backedge ]
%k = add i32 %indvar, 1
br i1 undef, label %cond_true, label %cond_false
%indvar = phi i32 [ 0, %entry ], [ %k, %bb.backedge ]
%k = add i32 %indvar, 1
br i1 undef, label %cond_true, label %cond_false
cond_true:
%tmp97 = icmp slt i32 %k, 10
br i1 %tmp97, label %bb.backedge, label %bb12
%tmp97 = icmp slt i32 %k, 10
br i1 %tmp97, label %bb.backedge, label %bb12
bb.backedge:
br label %bb
br label %bb
cond_false:
%tmp9 = icmp slt i32 %k, 10
br i1 %tmp9, label %bb.backedge, label %bb12
%tmp9 = icmp slt i32 %k, 10
br i1 %tmp9, label %bb.backedge, label %bb12
bb12:
%tmp14 = icmp eq i32 %k, 10
br i1 %tmp14, label %cond_next18, label %cond_true17
%tmp14 = icmp eq i32 %k, 10
br i1 %tmp14, label %cond_next18, label %cond_true17
cond_true17:
tail call void @abort( )
unreachable
tail call void @abort( )
unreachable
cond_next18:
ret i32 0
ret i32 0
}
declare void @abort()

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
; RUN: opt < %s -S -passes=ipsccp | FileCheck %s
; After the first round of Solver.Solve(), the return value of @testf still
@ -6,10 +7,16 @@
; false branch to be feasible. We later discover that @testf actually
; returns true, so we end up with an unfolded "br i1 true".
define void @test1() {
; CHECK-LABEL: @test1(
; CHECK-LABEL: if.then:
; CHECK: [[CALL:%.+]] = call i1 @testf()
; CHECK-NEXT: br i1 true, label %if.end, label %if.then
; CHECK-LABEL: define {{[^@]+}}@test1() {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[IF_THEN:%.*]]
; CHECK: if.then:
; CHECK-NEXT: [[FOO:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[NEXT:%.*]], [[IF_THEN]] ]
; CHECK-NEXT: [[NEXT]] = add i32 [[FOO]], 1
; CHECK-NEXT: [[CALL:%.*]] = call i1 @testf()
; CHECK-NEXT: br i1 true, label [[IF_END:%.*]], label [[IF_THEN]]
; CHECK: if.end:
; CHECK-NEXT: ret void
;
entry:
br label %if.then
@ -24,7 +31,7 @@ if.end: ; preds = %if.then, %entry
}
define internal i1 @testf() {
; CHECK-LABEL: define internal i1 @testf(
; CHECK-LABEL: define {{[^@]+}}@testf() {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[IF_END3:%.*]]
; CHECK: if.end3:
@ -40,15 +47,15 @@ if.end3: ; preds = %if.then1, %entry
ret i1 true
}
; Call sites in unreachable blocks should not be a problem.
; CHECK-LABEL: define i1 @test2() {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %if.end
; CHECK-LABEL: if.end: ; preds = %entry
; CHECK-NEXT: %call2 = call i1 @testf()
; CHECK-NEXT: ret i1 true
define i1 @test2() {
; CHECK-LABEL: define {{[^@]+}}@test2() {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[IF_END:%.*]]
; CHECK: if.end:
; CHECK-NEXT: [[CALL2:%.*]] = call i1 @testf()
; CHECK-NEXT: ret i1 true
;
entry:
br label %if.end