forked from OSchip/llvm-project
[Test] Clear out br i1 undef from tests to avoid UB
We don't want to test possible unexpected impact of such branches. Replacing them with regular conditions. Idea by Nikita Popov.
This commit is contained in:
parent
b7d2c173eb
commit
976926e8ee
|
@ -655,7 +655,7 @@ failure:
|
|||
unreachable
|
||||
}
|
||||
|
||||
define i32 @test_multiple_pred_2() {
|
||||
define i32 @test_multiple_pred_2(i1 %cond, i1 %cond2) {
|
||||
; CHECK-LABEL: @test_multiple_pred_2(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||
|
@ -665,13 +665,13 @@ define i32 @test_multiple_pred_2() {
|
|||
; CHECK-NEXT: [[IS_POSITIVE:%.*]] = icmp sgt i32 [[SUB]], 0
|
||||
; CHECK-NEXT: br i1 [[IS_POSITIVE]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK: if.true.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE:%.*]]
|
||||
; CHECK: if.true.2:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND2:%.*]], label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK: if.false.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false.2:
|
||||
|
@ -700,7 +700,7 @@ loop: ; preds = %backedge, %entry
|
|||
br i1 %is.positive, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
br i1 undef, label %if.true.1, label %if.true.2
|
||||
br i1 %cond, label %if.true.1, label %if.true.2
|
||||
|
||||
if.true.1:
|
||||
br label %backedge
|
||||
|
@ -709,7 +709,7 @@ if.true.2:
|
|||
br label %backedge
|
||||
|
||||
if.false: ; preds = %loop
|
||||
br i1 undef, label %if.false.1, label %if.false.2
|
||||
br i1 %cond2, label %if.false.1, label %if.false.2
|
||||
|
||||
if.false.1:
|
||||
br label %backedge
|
||||
|
@ -732,7 +732,7 @@ failure:
|
|||
}
|
||||
|
||||
; TODO: We can break the backedge here by assuming that undef = sub.
|
||||
define i32 @test_multiple_pred_undef_1() {
|
||||
define i32 @test_multiple_pred_undef_1(i1 %cond, i1 %cond2) {
|
||||
; CHECK-LABEL: @test_multiple_pred_undef_1(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||
|
@ -742,13 +742,13 @@ define i32 @test_multiple_pred_undef_1() {
|
|||
; CHECK-NEXT: [[IS_POSITIVE:%.*]] = icmp sgt i32 [[SUB]], 0
|
||||
; CHECK-NEXT: br i1 [[IS_POSITIVE]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK: if.true.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.true.2:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND2:%.*]], label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK: if.false.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false.2:
|
||||
|
@ -774,7 +774,7 @@ loop: ; preds = %backedge, %entry
|
|||
br i1 %is.positive, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
br i1 undef, label %if.true.1, label %if.true.2
|
||||
br i1 %cond, label %if.true.1, label %if.true.2
|
||||
|
||||
if.true.1:
|
||||
br label %backedge
|
||||
|
@ -783,7 +783,7 @@ if.true.2:
|
|||
br label %backedge
|
||||
|
||||
if.false: ; preds = %loop
|
||||
br i1 undef, label %if.false.1, label %if.false.2
|
||||
br i1 %cond2, label %if.false.1, label %if.false.2
|
||||
|
||||
if.false.1:
|
||||
br label %backedge
|
||||
|
@ -806,7 +806,7 @@ failure:
|
|||
}
|
||||
|
||||
; TODO: We can break the backedge here by assuming that undef = sub.
|
||||
define i32 @test_multiple_pred_undef_2() {
|
||||
define i32 @test_multiple_pred_undef_2(i1 %cond, i1 %cond2) {
|
||||
; CHECK-LABEL: @test_multiple_pred_undef_2(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||
|
@ -816,13 +816,13 @@ define i32 @test_multiple_pred_undef_2() {
|
|||
; CHECK-NEXT: [[IS_POSITIVE:%.*]] = icmp sgt i32 [[SUB]], 0
|
||||
; CHECK-NEXT: br i1 [[IS_POSITIVE]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK: if.true.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.true.2:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND2:%.*]], label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK: if.false.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false.2:
|
||||
|
@ -848,7 +848,7 @@ loop: ; preds = %backedge, %entry
|
|||
br i1 %is.positive, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
br i1 undef, label %if.true.1, label %if.true.2
|
||||
br i1 %cond, label %if.true.1, label %if.true.2
|
||||
|
||||
if.true.1:
|
||||
br label %backedge
|
||||
|
@ -857,7 +857,7 @@ if.true.2:
|
|||
br label %backedge
|
||||
|
||||
if.false: ; preds = %loop
|
||||
br i1 undef, label %if.false.1, label %if.false.2
|
||||
br i1 %cond2, label %if.false.1, label %if.false.2
|
||||
|
||||
if.false.1:
|
||||
br label %backedge
|
||||
|
@ -880,7 +880,7 @@ failure:
|
|||
}
|
||||
|
||||
; TODO: We can break the backedge here by exploiting undef.
|
||||
define i32 @test_multiple_pred_undef_3() {
|
||||
define i32 @test_multiple_pred_undef_3(i1 %cond, i1 %cond2) {
|
||||
; CHECK-LABEL: @test_multiple_pred_undef_3(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||
|
@ -890,13 +890,13 @@ define i32 @test_multiple_pred_undef_3() {
|
|||
; CHECK-NEXT: [[IS_POSITIVE:%.*]] = icmp sgt i32 [[SUB]], 0
|
||||
; CHECK-NEXT: br i1 [[IS_POSITIVE]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_TRUE_1:%.*]], label [[IF_TRUE_2:%.*]]
|
||||
; CHECK: if.true.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.true.2:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: br i1 undef, label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK-NEXT: br i1 [[COND2:%.*]], label [[IF_FALSE_1:%.*]], label [[IF_FALSE_2:%.*]]
|
||||
; CHECK: if.false.1:
|
||||
; CHECK-NEXT: br label [[BACKEDGE]]
|
||||
; CHECK: if.false.2:
|
||||
|
@ -922,7 +922,7 @@ loop: ; preds = %backedge, %entry
|
|||
br i1 %is.positive, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
br i1 undef, label %if.true.1, label %if.true.2
|
||||
br i1 %cond, label %if.true.1, label %if.true.2
|
||||
|
||||
if.true.1:
|
||||
br label %backedge
|
||||
|
@ -931,7 +931,7 @@ if.true.2:
|
|||
br label %backedge
|
||||
|
||||
if.false: ; preds = %loop
|
||||
br i1 undef, label %if.false.1, label %if.false.2
|
||||
br i1 %cond2, label %if.false.1, label %if.false.2
|
||||
|
||||
if.false.1:
|
||||
br label %backedge
|
||||
|
|
Loading…
Reference in New Issue