[JT][CVP] Regenerate test checks, again

The changes to update_test_checks format have been disabled again,
so regenerate these tests. Also regenerate select.ll.
This commit is contained in:
Nikita Popov 2019-11-01 22:27:48 +01:00
parent 68d19667b4
commit ca2dea6aec
5 changed files with 136 additions and 61 deletions

View File

@ -11,7 +11,7 @@ declare void @check2(i1) #1
; Make sure we propagate the value of %tmp35 to the true/false cases
define void @test1(i64 %tmp35) {
; CHECK-LABEL: define {{[^@]+}}@test1(
; CHECK-LABEL: @test1(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[TMP36:%.*]] = icmp sgt i64 [[TMP35:%.*]], 0
; CHECK-NEXT: br i1 [[TMP36]], label [[BB_TRUE:%.*]], label [[BB_FALSE:%.*]]
@ -41,7 +41,7 @@ bb_false:
; get %tmp36 from both true and false BBs.
define void @test2(i64 %tmp35, i1 %inner_cmp) {
; CHECK-LABEL: define {{[^@]+}}@test2(
; CHECK-LABEL: @test2(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[TMP36:%.*]] = icmp sgt i64 [[TMP35:%.*]], 0
; CHECK-NEXT: br i1 [[TMP36]], label [[BB_TRUE:%.*]], label [[BB_FALSE:%.*]]
@ -85,7 +85,7 @@ bb_false:
; Make sure binary operator transfer functions are run when RHS is non-constant
define i1 @test3(i32 %x, i32 %y) #0 {
; CHECK-LABEL: define {{[^@]+}}@test3(
; CHECK-LABEL: @test3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 10
; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
@ -124,7 +124,7 @@ out:
; Same as previous but make sure nobody gets over-zealous
define i1 @test4(i32 %x, i32 %y) #0 {
; CHECK-LABEL: define {{[^@]+}}@test4(
; CHECK-LABEL: @test4(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 10
; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
@ -165,7 +165,7 @@ out:
; Make sure binary operator transfer functions are run when RHS is non-constant
define i1 @test5(i32 %x, i32 %y) #0 {
; CHECK-LABEL: define {{[^@]+}}@test5(
; CHECK-LABEL: @test5(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 5
; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
@ -204,7 +204,7 @@ out:
; Same as previous but make sure nobody gets over-zealous
define i1 @test6(i32 %x, i32 %y) #0 {
; CHECK-LABEL: define {{[^@]+}}@test6(
; CHECK-LABEL: @test6(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 5
; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
@ -243,7 +243,7 @@ out:
}
define i1 @test7(i32 %a, i32 %b) {
; CHECK-LABEL: define {{[^@]+}}@test7(
; CHECK-LABEL: @test7(
; CHECK-NEXT: begin:
; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
@ -279,7 +279,7 @@ exit:
}
define i1 @test8(i32 %a, i32 %b) {
; CHECK-LABEL: define {{[^@]+}}@test8(
; CHECK-LABEL: @test8(
; CHECK-NEXT: begin:
; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
@ -313,7 +313,7 @@ exit:
}
define i1 @test10(i32 %a, i32 %b) {
; CHECK-LABEL: define {{[^@]+}}@test10(
; CHECK-LABEL: @test10(
; CHECK-NEXT: begin:
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[A:%.*]], -256
; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
@ -345,7 +345,7 @@ exit:
}
define i1 @test11(i32 %a, i32 %b) {
; CHECK-LABEL: define {{[^@]+}}@test11(
; CHECK-LABEL: @test11(
; CHECK-NEXT: begin:
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[A:%.*]], -256
; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
@ -375,7 +375,7 @@ exit:
}
define i1 @test12(i32 %x) {
; CHECK-LABEL: define {{[^@]+}}@test12(
; CHECK-LABEL: @test12(
; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[X:%.*]] to i64
; CHECK-NEXT: [[MUL:%.*]] = mul nuw nsw i64 [[ZEXT]], 7
; CHECK-NEXT: [[SHR:%.*]] = lshr i64 [[MUL]], 32
@ -392,7 +392,7 @@ define i1 @test12(i32 %x) {
}
define i1 @test13(i8 %x, i64* %p) {
; CHECK-LABEL: define {{[^@]+}}@test13(
; CHECK-LABEL: @test13(
; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 [[X:%.*]] to i64
; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[ZEXT]], 128
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[ADD]], 384

View File

@ -1,30 +1,47 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -correlated-propagation -S | FileCheck %s
; CHECK-LABEL: @simple(
define i8 @simple(i1) {
; CHECK-LABEL: @simple(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[S:%.*]] = select i1 [[TMP0:%.*]], i8 0, i8 1
; CHECK-NEXT: br i1 [[TMP0]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
; CHECK-NEXT: ret i8 0
; CHECK: else:
; CHECK-NEXT: ret i8 1
;
entry:
%s = select i1 %0, i8 0, i8 1
br i1 %0, label %then, label %else
then:
; CHECK: ret i8 0
%a = phi i8 [ %s, %entry ]
ret i8 %a
else:
; CHECK: ret i8 1
%b = phi i8 [ %s, %entry ]
ret i8 %b
}
; CHECK-LABEL: @loop(
define void @loop(i32) {
; CHECK-LABEL: @loop(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[IDX:%.*]] = phi i32 [ [[TMP0:%.*]], [[ENTRY:%.*]] ], [ [[TMP2:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[IDX]], 0
; CHECK-NEXT: [[TMP2]] = add i32 [[IDX]], -1
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[TMP1]], i32 0, i32 [[TMP2]]
; CHECK-NEXT: br i1 [[TMP1]], label [[OUT:%.*]], label [[LOOP]]
; CHECK: out:
; CHECK-NEXT: ret void
;
entry:
br label %loop
loop:
%idx = phi i32 [ %0, %entry ], [ %sel, %loop ]
; CHECK: %idx = phi i32 [ %0, %entry ], [ %2, %loop ]
%1 = icmp eq i32 %idx, 0
%2 = add i32 %idx, -1
%sel = select i1 %1, i32 0, i32 %2
@ -34,19 +51,25 @@ out:
ret void
}
; CHECK-LABEL: @not_correlated(
define i8 @not_correlated(i1, i1) {
; CHECK-LABEL: @not_correlated(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[S:%.*]] = select i1 [[TMP0:%.*]], i8 0, i8 1
; CHECK-NEXT: br i1 [[TMP1:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
; CHECK-NEXT: ret i8 [[S]]
; CHECK: else:
; CHECK-NEXT: ret i8 [[S]]
;
entry:
%s = select i1 %0, i8 0, i8 1
br i1 %1, label %then, label %else
then:
; CHECK: ret i8 %s
%a = phi i8 [ %s, %entry ]
ret i8 %a
else:
; CHECK: ret i8 %s
%b = phi i8 [ %s, %entry ]
ret i8 %b
}
@ -54,8 +77,17 @@ else:
@c = global i32 0, align 4
@b = global i32 0, align 4
; CHECK-LABEL: @PR23752(
define i32 @PR23752() {
; CHECK-LABEL: @PR23752(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
; CHECK: for.body:
; CHECK-NEXT: [[SEL:%.*]] = select i1 icmp sgt (i32* @b, i32* @c), i32 0, i32 1
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[SEL]], 1
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
; CHECK: if.end:
; CHECK-NEXT: ret i32 1
;
entry:
br label %for.body
@ -65,17 +97,24 @@ for.body:
%cmp = icmp ne i32 %sel, 1
br i1 %cmp, label %for.body, label %if.end
; CHECK: %[[sel:.*]] = select i1 icmp sgt (i32* @b, i32* @c), i32 0, i32 1
; CHECK-NEXT: %[[cmp:.*]] = icmp ne i32 %[[sel]], 1
; CHECK-NEXT: br i1 %[[cmp]]
if.end:
ret i32 %sel
; CHECK: ret i32 1
}
define i1 @test1(i32* %p, i1 %unknown) {
; CHECK-LABEL: @test1
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[PVAL:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[PVAL]], 255
; CHECK-NEXT: br i1 [[CMP1]], label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[UNKNOWN:%.*]], i32 [[PVAL]], i32 5
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: ret i1 false
; CHECK: exit:
; CHECK-NEXT: ret i1 true
;
%pval = load i32, i32* %p
%cmp1 = icmp slt i32 %pval, 255
br i1 %cmp1, label %next, label %exit
@ -85,20 +124,28 @@ next:
;; TODO: This pointless branch shouldn't be neccessary
br label %next2
next2:
; CHECK-LABEL: next2:
; CHECK: ret i1 false
%res = icmp eq i32 %min, 255
ret i1 %res
exit:
; CHECK-LABEL: exit:
; CHECK: ret i1 true
ret i1 true
}
; Check that we take a conservative meet
define i1 @test2(i32* %p, i32 %qval, i1 %unknown) {
; CHECK-LABEL: test2
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[PVAL:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[PVAL]], 255
; CHECK-NEXT: br i1 [[CMP1]], label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[UNKNOWN:%.*]], i32 [[PVAL]], i32 [[QVAL:%.*]]
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[MIN]], 255
; CHECK-NEXT: ret i1 [[RES]]
; CHECK: exit:
; CHECK-NEXT: ret i1 true
;
%pval = load i32, i32* %p
%cmp1 = icmp slt i32 %pval, 255
br i1 %cmp1, label %next, label %exit
@ -108,20 +155,28 @@ next:
;; TODO: This pointless branch shouldn't be neccessary
br label %next2
next2:
; CHECK-LABEL: next2
; CHECK: ret i1 %res
%res = icmp eq i32 %min, 255
ret i1 %res
exit:
; CHECK-LABEL: exit:
; CHECK: ret i1 true
ret i1 true
}
; Same as @test2, but for the opposite select input
define i1 @test3(i32* %p, i32 %qval, i1 %unknown) {
; CHECK-LABEL: test3
; CHECK-LABEL: @test3(
; CHECK-NEXT: [[PVAL:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[PVAL]], 255
; CHECK-NEXT: br i1 [[CMP1]], label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[UNKNOWN:%.*]], i32 [[QVAL:%.*]], i32 [[PVAL]]
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[MIN]], 255
; CHECK-NEXT: ret i1 [[RES]]
; CHECK: exit:
; CHECK-NEXT: ret i1 true
;
%pval = load i32, i32* %p
%cmp1 = icmp slt i32 %pval, 255
br i1 %cmp1, label %next, label %exit
@ -131,14 +186,10 @@ next:
;; TODO: This pointless branch shouldn't be neccessary
br label %next2
next2:
; CHECK-LABEL: next2
; CHECK: ret i1 %res
%res = icmp eq i32 %min, 255
ret i1 %res
exit:
; CHECK-LABEL: exit:
; CHECK: ret i1 true
ret i1 true
}
@ -147,7 +198,19 @@ exit:
; is to get around the fact that all integers (including constants
; and non-constants) are actually represented as constant-ranges.
define i1 @test4(i32* %p, i32 %qval, i1 %unknown) {
; CHECK-LABEL: test4
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[PVAL:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[PVAL]], 255
; CHECK-NEXT: br i1 [[CMP1]], label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[UNKNOWN:%.*]], double 1.000000e+00, double 0.000000e+00
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: [[RES:%.*]] = fcmp oeq double [[MIN]], 3.000000e+02
; CHECK-NEXT: ret i1 [[RES]]
; CHECK: exit:
; CHECK-NEXT: ret i1 true
;
%pval = load i32, i32* %p
%cmp1 = icmp slt i32 %pval, 255
br i1 %cmp1, label %next, label %exit
@ -157,22 +220,30 @@ next:
;; TODO: This pointless branch shouldn't be neccessary
br label %next2
next2:
; CHECK-LABEL: next2
; CHECK: ret i1 %res
%res = fcmp oeq double %min, 300.0
ret i1 %res
exit:
; CHECK-LABEL: exit:
; CHECK: ret i1 true
ret i1 true
}
;; Using the condition to clamp the result
;;
;;
define i1 @test5(i32* %p, i1 %unknown) {
; CHECK-LABEL: @test5
; CHECK-LABEL: @test5(
; CHECK-NEXT: [[PVAL:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[PVAL]], 255
; CHECK-NEXT: br i1 [[CMP1]], label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[COND:%.*]] = icmp sgt i32 [[PVAL]], 0
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[COND]], i32 [[PVAL]], i32 5
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: ret i1 false
; CHECK: exit:
; CHECK-NEXT: ret i1 true
;
%pval = load i32, i32* %p
%cmp1 = icmp slt i32 %pval, 255
br i1 %cmp1, label %next, label %exit
@ -183,19 +254,27 @@ next:
;; TODO: This pointless branch shouldn't be neccessary
br label %next2
next2:
; CHECK-LABEL: next2:
; CHECK: ret i1 false
%res = icmp eq i32 %min, -1
ret i1 %res
exit:
; CHECK-LABEL: exit:
; CHECK: ret i1 true
ret i1 true
}
define i1 @test6(i32* %p, i1 %unknown) {
; CHECK-LABEL: @test6
; CHECK-LABEL: @test6(
; CHECK-NEXT: [[PVAL:%.*]] = load i32, i32* [[P:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[PVAL]], 255
; CHECK-NEXT: br i1 [[CMP1]], label [[NEXT:%.*]], label [[EXIT:%.*]]
; CHECK: next:
; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[PVAL]], 254
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND]], i32 [[PVAL]], i32 1
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: ret i1 true
; CHECK: exit:
; CHECK-NEXT: ret i1 true
;
%pval = load i32, i32* %p
%cmp1 = icmp ult i32 %pval, 255
br i1 %cmp1, label %next, label %exit
@ -206,13 +285,9 @@ next:
;; TODO: This pointless branch shouldn't be neccessary
br label %next2
next2:
; CHECK-LABEL: next2:
; CHECK: ret i1 true
%res = icmp slt i32 %sel, 254
ret i1 %res
exit:
; CHECK-LABEL: exit:
; CHECK: ret i1 true
ret i1 true
}

View File

@ -2,7 +2,7 @@
; RUN: opt -S < %s -jump-threading | FileCheck %s
define void @foo() {
; CHECK-LABEL: define {{[^@]+}}@foo(
; CHECK-LABEL: @foo(
; CHECK-NEXT: exit2:
; CHECK-NEXT: ret void
;

View File

@ -8,7 +8,7 @@
declare void @opaque_body()
define void @jump_threading_loopheader() {
; CHECK-LABEL: define {{[^@]+}}@jump_threading_loopheader(
; CHECK-LABEL: @jump_threading_loopheader(
; CHECK-NEXT: top:
; CHECK-NEXT: br label [[ENTRY:%.*]]
; CHECK: entry:
@ -53,7 +53,7 @@ exit:
; instruction because jump-threading relies on that to decide which edge to
; try to thread first.
define void @jump_threading_loopheader2() {
; CHECK-LABEL: define {{[^@]+}}@jump_threading_loopheader2(
; CHECK-LABEL: @jump_threading_loopheader2(
; CHECK-NEXT: top:
; CHECK-NEXT: br label [[ENTRY:%.*]]
; CHECK: entry:
@ -96,7 +96,7 @@ exit:
; Check if we can handle undef branch condition.
define void @jump_threading_loopheader3() {
; CHECK-LABEL: define {{[^@]+}}@jump_threading_loopheader3(
; CHECK-LABEL: @jump_threading_loopheader3(
; CHECK-NEXT: top:
; CHECK-NEXT: br label [[ENTRY:%.*]]
; CHECK: entry:

View File

@ -2,7 +2,7 @@
; RUN: opt -S -jump-threading < %s | FileCheck %s
define i8 @test(i32 %a, i32 %length) {
; CHECK-LABEL: define {{[^@]+}}@test(
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[BACKEDGE:%.*]]
; CHECK: backedge: