[LVI] Regenerate test checks; NFC

This commit is contained in:
Nikita Popov 2019-04-29 21:12:38 +02:00
parent 11850a6305
commit 1cfe3e6df9
3 changed files with 100 additions and 56 deletions

View File

@ -1,8 +1,11 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s -jump-threading | FileCheck %s
; CHECK-LABEL: @foo
; CHECK-NEXT: exit2:
; CHECK-NEXT: ret void
define void @foo() {
; CHECK-LABEL: define {{[^@]+}}@foo(
; CHECK-NEXT: exit2:
; CHECK-NEXT: ret void
;
entry:
br label %bb1

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -jump-threading < %s | FileCheck %s
; Check that the heuristic for avoiding accidental introduction of irreducible
@ -7,93 +8,126 @@
declare void @opaque_body()
define void @jump_threading_loopheader() {
; CHECK-LABEL: @jump_threading_loopheader
; CHECK-LABEL: define {{[^@]+}}@jump_threading_loopheader(
; CHECK-NEXT: top:
; CHECK-NEXT: br label [[ENTRY:%.*]]
; CHECK: entry:
; CHECK-NEXT: [[IND:%.*]] = phi i32 [ 0, [[TOP:%.*]] ], [ [[NEXTIND:%.*]], [[LATCH:%.*]] ]
; CHECK-NEXT: [[NEXTIND]] = add i32 [[IND]], 1
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[IND]], 10
; CHECK-NEXT: br i1 [[CMP]], label [[LATCH]], label [[EXIT:%.*]]
; CHECK: latch:
; CHECK-NEXT: call void @opaque_body()
; CHECK-NEXT: br label [[ENTRY]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
top:
br label %entry
br label %entry
entry:
%ind = phi i32 [0, %top], [%nextind, %latch]
%nextind = add i32 %ind, 1
%cmp = icmp ule i32 %ind, 10
; CHECK: br i1 %cmp, label %latch, label %exit
br i1 %cmp, label %body, label %latch
%ind = phi i32 [0, %top], [%nextind, %latch]
%nextind = add i32 %ind, 1
%cmp = icmp ule i32 %ind, 10
br i1 %cmp, label %body, label %latch
body:
call void @opaque_body()
; CHECK: br label %entry
br label %latch
call void @opaque_body()
br label %latch
latch:
%cond = phi i2 [1, %entry], [2, %body]
switch i2 %cond, label %unreach [
i2 2, label %entry
i2 1, label %exit
]
%cond = phi i2 [1, %entry], [2, %body]
switch i2 %cond, label %unreach [
i2 2, label %entry
i2 1, label %exit
]
unreach:
unreachable
unreachable
exit:
ret void
ret void
}
; We also need to check the opposite order of the branches, in the switch
; instruction because jump-threading relies on that to decide which edge to
; try to thread first.
define void @jump_threading_loopheader2() {
; CHECK-LABEL: @jump_threading_loopheader2
; CHECK-LABEL: define {{[^@]+}}@jump_threading_loopheader2(
; CHECK-NEXT: top:
; CHECK-NEXT: br label [[ENTRY:%.*]]
; CHECK: entry:
; CHECK-NEXT: [[IND:%.*]] = phi i32 [ 0, [[TOP:%.*]] ], [ [[NEXTIND:%.*]], [[LATCH:%.*]] ]
; CHECK-NEXT: [[NEXTIND]] = add i32 [[IND]], 1
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[IND]], 10
; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LATCH]]
; CHECK: latch:
; CHECK-NEXT: br label [[ENTRY]]
; CHECK: exit:
; CHECK-NEXT: call void @opaque_body()
; CHECK-NEXT: ret void
;
top:
br label %entry
br label %entry
entry:
%ind = phi i32 [0, %top], [%nextind, %latch]
%nextind = add i32 %ind, 1
%cmp = icmp ule i32 %ind, 10
; CHECK: br i1 %cmp, label %exit, label %latch
br i1 %cmp, label %body, label %latch
%ind = phi i32 [0, %top], [%nextind, %latch]
%nextind = add i32 %ind, 1
%cmp = icmp ule i32 %ind, 10
br i1 %cmp, label %body, label %latch
body:
call void @opaque_body()
; CHECK: br label %entry
br label %latch
call void @opaque_body()
br label %latch
latch:
%cond = phi i2 [1, %entry], [2, %body]
switch i2 %cond, label %unreach [
i2 1, label %entry
i2 2, label %exit
]
%cond = phi i2 [1, %entry], [2, %body]
switch i2 %cond, label %unreach [
i2 1, label %entry
i2 2, label %exit
]
unreach:
unreachable
unreachable
exit:
ret void
ret void
}
; Check if we can handle undef branch condition.
define void @jump_threading_loopheader3() {
; CHECK-LABEL: @jump_threading_loopheader3
; CHECK-LABEL: define {{[^@]+}}@jump_threading_loopheader3(
; CHECK-NEXT: top:
; CHECK-NEXT: br label [[ENTRY:%.*]]
; CHECK: entry:
; CHECK-NEXT: [[IND:%.*]] = phi i32 [ 0, [[TOP:%.*]] ], [ [[NEXTIND:%.*]], [[LATCH:%.*]] ]
; CHECK-NEXT: [[NEXTIND]] = add i32 [[IND]], 1
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[IND]], 10
; CHECK-NEXT: br i1 [[CMP]], label [[LATCH]], label [[EXIT:%.*]]
; CHECK: latch:
; CHECK-NEXT: call void @opaque_body()
; CHECK-NEXT: br label [[ENTRY]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
top:
br label %entry
br label %entry
entry:
%ind = phi i32 [0, %top], [%nextind, %latch]
%nextind = add i32 %ind, 1
%cmp = icmp ule i32 %ind, 10
; CHECK: br i1 %cmp, label %latch, label %exit
br i1 %cmp, label %body, label %latch
%ind = phi i32 [0, %top], [%nextind, %latch]
%nextind = add i32 %ind, 1
%cmp = icmp ule i32 %ind, 10
br i1 %cmp, label %body, label %latch
body:
call void @opaque_body()
; CHECK: br label %entry
br label %latch
call void @opaque_body()
br label %latch
latch:
%phi = phi i32 [undef, %entry], [0, %body]
%cmp1 = icmp eq i32 %phi, 0
br i1 %cmp1, label %entry, label %exit
%phi = phi i32 [undef, %entry], [0, %body]
%cmp1 = icmp eq i32 %phi, 0
br i1 %cmp1, label %entry, label %exit
exit:
ret void
ret void
}

View File

@ -1,15 +1,22 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -jump-threading < %s | FileCheck %s
define i8 @test(i32 %a, i32 %length) {
; CHECK-LABEL: @test
; CHECK-LABEL: define {{[^@]+}}@test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[BACKEDGE:%.*]]
; CHECK: backedge:
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE]] ]
; CHECK-NEXT: [[IV_NEXT]] = add nsw i32 [[IV]], 1
; CHECK-NEXT: [[CONT:%.*]] = icmp slt i32 [[IV_NEXT]], 400
; CHECK-NEXT: br i1 [[CONT]], label [[BACKEDGE]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret i8 0
;
entry:
; CHECK: br label %backedge
br label %loop
loop:
; CHECK-LABEL: backedge:
; CHECK: phi i32
; CHECK: br i1 %cont, label %backedge, label %exit
%iv = phi i32 [0, %entry], [%iv.next, %backedge]
;; We can use an inductive argument to prove %iv is always positive
%cnd = icmp sge i32 %iv, 0