[llvm] 88ad44e - [llvm] Remove `br i1 undef` from some regression tests [NFC] (#115817)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 01:11:51 PST 2024


Author: Lee Wei
Date: 2024-11-12T09:11:47Z
New Revision: 88ad44ec43bdaba5185a0227ec81eb15bd0f7c5a

URL: https://github.com/llvm/llvm-project/commit/88ad44ec43bdaba5185a0227ec81eb15bd0f7c5a
DIFF: https://github.com/llvm/llvm-project/commit/88ad44ec43bdaba5185a0227ec81eb15bd0f7c5a.diff

LOG: [llvm] Remove `br i1 undef` from some regression tests [NFC] (#115817)

This PR removes tests with `br i1 undef` under `llvm/tests/G*`.
There were a few tests that I couldn't fix to pass lit. I'll come back
and fix those later.

Added: 
    

Modified: 
    llvm/test/Transforms/GVN/2011-04-27-phioperands.ll
    llvm/test/Transforms/GVN/2012-05-22-PreCrash.ll
    llvm/test/Transforms/GVN/PRE/phi-translate-2.ll
    llvm/test/Transforms/GVN/PRE/pre-loop-load-new-pm.ll
    llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
    llvm/test/Transforms/GVN/PRE/preserve-tbaa.ll
    llvm/test/Transforms/GVN/crash.ll
    llvm/test/Transforms/GVN/equality-assume.ll
    llvm/test/Transforms/GVN/pre-new-inst.ll
    llvm/test/Transforms/GVN/stale-loop-info.ll
    llvm/test/Transforms/GVN/unreachable_block_infinite_loop.ll
    llvm/test/Transforms/GVNHoist/hoist-call.ll
    llvm/test/Transforms/GVNHoist/hoist-mssa.ll
    llvm/test/Transforms/GVNHoist/hoist-simplify-phi.ll
    llvm/test/Transforms/GVNHoist/hoist-very-busy.ll
    llvm/test/Transforms/GVNHoist/non-trivial-phi.ll
    llvm/test/Transforms/GVNHoist/pr30216.ll
    llvm/test/Transforms/GVNHoist/pr36787.ll
    llvm/test/Transforms/GVNSink/dither.ll
    llvm/test/Transforms/GVNSink/sink-common-code.ll
    llvm/test/Transforms/GVNSink/struct.ll
    llvm/test/Transforms/GuardWidening/basic.ll
    llvm/test/Transforms/GuardWidening/basic_widenable_condition_guards.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/GVN/2011-04-27-phioperands.ll b/llvm/test/Transforms/GVN/2011-04-27-phioperands.ll
index d01d949f4883fb..a29dc98ab25ade 100644
--- a/llvm/test/Transforms/GVN/2011-04-27-phioperands.ll
+++ b/llvm/test/Transforms/GVN/2011-04-27-phioperands.ll
@@ -4,12 +4,12 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
 
 @nuls = external global [10 x i8]
 
-define fastcc void @p_ere() nounwind {
+define fastcc void @p_ere(i1 %arg) nounwind {
 entry:
   br label %"<bb 5>"
 
 "<L18>.i":
-  br i1 undef, label %"<bb 3>.i30.i", label %doemit.exit51.i
+  br i1 %arg, label %"<bb 3>.i30.i", label %doemit.exit51.i
 
 "<bb 3>.i30.i":
   unreachable
@@ -18,7 +18,7 @@ doemit.exit51.i:
   br label %"<bb 53>.i"
 
 "<L19>.i":
-  br i1 undef, label %"<bb 3>.i55.i", label %doemit.exit76.i
+  br i1 %arg, label %"<bb 3>.i55.i", label %doemit.exit76.i
 
 "<bb 3>.i55.i":
   unreachable
@@ -34,7 +34,7 @@ doemit.exit76.i:
   br label %"<bb 53>.i"
 
 "<L24>.i":
-  br i1 undef, label %"<bb 53>.i", label %"<bb 35>.i"
+  br i1 %arg, label %"<bb 53>.i", label %"<bb 35>.i"
 
 "<bb 35>.i":
   br label %"<bb 53>.i"
@@ -51,13 +51,13 @@ doemit.exit76.i:
 "<bb 53>.i":
   %wascaret_2.i = phi i32 [ 0, %"<L39>.i" ], [ 0, %"<L29>.i" ], [ 0, %"<L28>.i" ], [ 0, %"<bb 35>.i" ], [ 0, %"<L99>.i" ], [ 0, %"<L98>.i" ], [ 0, %doemit.exit76.i ], [ 1, %doemit.exit51.i ], [ 0, %"<L24>.i" ]
   %D.5496_84.i = load ptr, ptr undef, align 8
-  br i1 undef, label %"<bb 54>.i", label %"<bb 5>"
+  br i1 %arg, label %"<bb 54>.i", label %"<bb 5>"
 
 "<bb 54>.i":
-  br i1 undef, label %"<bb 5>", label %"<bb 58>.i"
+  br i1 %arg, label %"<bb 5>", label %"<bb 58>.i"
 
 "<bb 58>.i":
-  br i1 undef, label %"<bb 64>.i", label %"<bb 59>.i"
+  br i1 %arg, label %"<bb 64>.i", label %"<bb 59>.i"
 
 "<bb 59>.i":
   br label %"<bb 64>.i"
@@ -71,7 +71,7 @@ doemit.exit76.i:
   ]
 
 "<L54>.i":
-  br i1 undef, label %"<bb 3>.i105.i", label %doemit.exit127.i
+  br i1 %arg, label %"<bb 3>.i105.i", label %doemit.exit127.i
 
 "<bb 3>.i105.i":
   unreachable
@@ -80,7 +80,7 @@ doemit.exit127.i:
   unreachable
 
 "<L55>.i":
-  br i1 undef, label %"<bb 3>.i157.i", label %"<bb 5>"
+  br i1 %arg, label %"<bb 3>.i157.i", label %"<bb 5>"
 
 "<bb 3>.i157.i":
   unreachable

diff  --git a/llvm/test/Transforms/GVN/2012-05-22-PreCrash.ll b/llvm/test/Transforms/GVN/2012-05-22-PreCrash.ll
index 6ef759ed6dfb0b..28b71786e48352 100644
--- a/llvm/test/Transforms/GVN/2012-05-22-PreCrash.ll
+++ b/llvm/test/Transforms/GVN/2012-05-22-PreCrash.ll
@@ -1,9 +1,9 @@
 ; RUN: opt < %s -passes=gvn
 ; PR12858
 
-define void @fn5(i16 signext %p1, i8 signext %p2) nounwind uwtable {
+define void @fn5(i16 signext %p1, i8 signext %p2, i1 %arg) nounwind uwtable {
 entry:
-  br i1 undef, label %if.else, label %if.then
+  br i1 %arg, label %if.else, label %if.then
 
 if.then:                                          ; preds = %entry
   br label %if.end
@@ -14,7 +14,7 @@ if.else:                                          ; preds = %entry
 
 if.end:                                           ; preds = %if.else, %if.then
   %conv1 = sext i16 %p1 to i32
-  br i1 undef, label %if.then3, label %if.else4
+  br i1 %arg, label %if.then3, label %if.else4
 
 if.then3:                                         ; preds = %if.end
   br label %if.end12

diff  --git a/llvm/test/Transforms/GVN/PRE/phi-translate-2.ll b/llvm/test/Transforms/GVN/PRE/phi-translate-2.ll
index bd54de4acd4f27..39790f4cddbb7a 100644
--- a/llvm/test/Transforms/GVN/PRE/phi-translate-2.ll
+++ b/llvm/test/Transforms/GVN/PRE/phi-translate-2.ll
@@ -251,7 +251,7 @@ if.end3:                                          ; preds = %if.then2, %if.else,
 ; Here the load from arrayidx1 is partially redundant, but its value is
 ; available in if.then. Check that we correctly phi-translate to the phi that
 ; the load has been replaced with.
-define void @test6(ptr %ptr) {
+define void @test6(ptr %ptr, i1 %arg) {
 ; CHECK-LABEL: @test6(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[ARRAYIDX1_PHI_TRANS_INSERT:%.*]] = getelementptr inbounds i32, ptr [[PTR:%.*]], i64 1
@@ -272,7 +272,7 @@ define void @test6(ptr %ptr) {
 ; CHECK-NEXT:    br label [[IF_END]]
 ; CHECK:       if.end:
 ; CHECK-NEXT:    [[TMP2]] = phi i32 [ [[TMP0]], [[IF_THEN]] ], [ [[TMP1]], [[WHILE]] ]
-; CHECK-NEXT:    br i1 undef, label [[WHILE_END:%.*]], label [[WHILE]]
+; CHECK-NEXT:    br i1 %arg, label [[WHILE_END:%.*]], label [[WHILE]]
 ; CHECK:       while.end:
 ; CHECK-NEXT:    ret void
 ;
@@ -295,7 +295,7 @@ if.then:
   br label %if.end
 
 if.end:
-  br i1 undef, label %while.end, label %while
+  br i1 %arg, label %while.end, label %while
 
 while.end:
   ret void

diff  --git a/llvm/test/Transforms/GVN/PRE/pre-loop-load-new-pm.ll b/llvm/test/Transforms/GVN/PRE/pre-loop-load-new-pm.ll
index 0d6500471bdb0f..e16c21e516eb51 100644
--- a/llvm/test/Transforms/GVN/PRE/pre-loop-load-new-pm.ll
+++ b/llvm/test/Transforms/GVN/PRE/pre-loop-load-new-pm.ll
@@ -432,7 +432,7 @@ cold_exit:
 }
 
 ; TODO: PRE via splittinga backedge in the cold loop. Make sure we don't insert a load into an inner loop.
-define i32 @test_inner_loop(ptr %p) {
+define i32 @test_inner_loop(ptr %p, i1 %arg) {
 ; CHECK-LABEL: @test_inner_loop(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
@@ -447,7 +447,7 @@ define i32 @test_inner_loop(ptr %p) {
 ; CHECK-NEXT:    br label [[INNER_LOOP:%.*]]
 ; CHECK:       inner_loop:
 ; CHECK-NEXT:    call void @side_effect()
-; CHECK-NEXT:    br i1 undef, label [[INNER_LOOP]], label [[BACKEDGE]]
+; CHECK-NEXT:    br i1 %arg, label [[INNER_LOOP]], label [[BACKEDGE]]
 ; CHECK:       backedge:
 ; CHECK-NEXT:    [[IV_NEXT]] = add i32 [[IV]], [[X]]
 ; CHECK-NEXT:    [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
@@ -472,7 +472,7 @@ cold_path:
 
 inner_loop:
   call void @side_effect()
-  br i1 undef, label %inner_loop, label %backedge
+  br i1 %arg, label %inner_loop, label %backedge
 
 backedge:
   %iv.next = add i32 %iv, %x

diff  --git a/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll b/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
index 376b9f1c8f5618..a9b69a49005e39 100644
--- a/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
+++ b/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
@@ -636,7 +636,7 @@ cold_exit:
 }
 
 ; TODO: PRE via splittinga backedge in the cold loop. Make sure we don't insert a load into an inner loop.
-define i32 @test_inner_loop(ptr %p) {
+define i32 @test_inner_loop(ptr %p, i1 %arg) {
 ; CHECK-LABEL: @test_inner_loop(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
@@ -651,7 +651,7 @@ define i32 @test_inner_loop(ptr %p) {
 ; CHECK-NEXT:    br label [[INNER_LOOP:%.*]]
 ; CHECK:       inner_loop:
 ; CHECK-NEXT:    call void @side_effect() #[[ATTR0]]
-; CHECK-NEXT:    br i1 undef, label [[INNER_LOOP]], label [[BACKEDGE]]
+; CHECK-NEXT:    br i1 %arg, label [[INNER_LOOP]], label [[BACKEDGE]]
 ; CHECK:       backedge:
 ; CHECK-NEXT:    [[IV_NEXT]] = add i32 [[IV]], [[X]]
 ; CHECK-NEXT:    [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
@@ -676,7 +676,7 @@ cold_path:
 
 inner_loop:
   call void @side_effect() nofree
-  br i1 undef, label %inner_loop, label %backedge
+  br i1 %arg, label %inner_loop, label %backedge
 
 backedge:
   %iv.next = add i32 %iv, %x

diff  --git a/llvm/test/Transforms/GVN/PRE/preserve-tbaa.ll b/llvm/test/Transforms/GVN/PRE/preserve-tbaa.ll
index d5b05ab8388608..3df63beefea68a 100644
--- a/llvm/test/Transforms/GVN/PRE/preserve-tbaa.ll
+++ b/llvm/test/Transforms/GVN/PRE/preserve-tbaa.ll
@@ -7,9 +7,9 @@ target datalayout = "e-p:64:64:64"
 ; CHECK-LABEL: @test(
 ; CHECK: %tmp33.pre = load i16, ptr %P, align 2, !tbaa !0
 ; CHECK: br label %for.body
-define void @test(ptr %P, ptr %Q) nounwind {
+define void @test(ptr %P, ptr %Q, i1 %arg) nounwind {
 entry:
-  br i1 undef, label %bb.nph, label %for.end
+  br i1 %arg, label %bb.nph, label %for.end
 
 bb.nph:                                           ; preds = %entry
   br label %for.body

diff  --git a/llvm/test/Transforms/GVN/crash.ll b/llvm/test/Transforms/GVN/crash.ll
index c6419e477dbae2..55a217af6dd554 100644
--- a/llvm/test/Transforms/GVN/crash.ll
+++ b/llvm/test/Transforms/GVN/crash.ll
@@ -5,9 +5,9 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10.0"
 
-define ptr @test1(ptr %name, i32 %namelen, ptr %o, i32 %expected_type) nounwind ssp {
+define ptr @test1(ptr %name, i32 %namelen, ptr %o, i32 %expected_type, i1 %arg) nounwind ssp {
 entry:
-  br i1 undef, label %if.end13, label %while.body.preheader
+  br i1 %arg, label %if.end13, label %while.body.preheader
 
 
 if.end13:                                         ; preds = %if.then6
@@ -22,25 +22,25 @@ while.body:                                       ; preds = %while.body.backedge
 
 lor.lhs.false:                                    ; preds = %while.body
   %tmp22 = load i32, ptr %o.addr.0                       ; <i32> [#uses=0]
-  br i1 undef, label %land.lhs.true24, label %if.end31
+  br i1 %arg, label %land.lhs.true24, label %if.end31
 
 land.lhs.true24:                                  ; preds = %lor.lhs.false
   %call28 = call ptr @parse_object(ptr undef) nounwind ; <ptr> [#uses=0]
-  br i1 undef, label %return.loopexit, label %if.end31
+  br i1 %arg, label %return.loopexit, label %if.end31
 
 if.end31:                                         ; preds = %land.lhs.true24, %lor.lhs.false
-  br i1 undef, label %return.loopexit, label %if.end41
+  br i1 %arg, label %return.loopexit, label %if.end41
 
 if.end41:                                         ; preds = %if.end31
   %tmp45 = load i32, ptr %o.addr.0                       ; <i32> [#uses=0]
-  br i1 undef, label %if.then50, label %if.else
+  br i1 %arg, label %if.then50, label %if.else
 
 if.then50:                                        ; preds = %if.end41
   %tmp53 = load ptr, ptr undef                       ; <ptr> [#uses=1]
   br label %while.body.backedge
 
 if.else:                                          ; preds = %if.end41
-  br i1 undef, label %if.then62, label %if.else67
+  br i1 %arg, label %if.then62, label %if.else67
 
 if.then62:                                        ; preds = %if.else
   br label %while.body.backedge
@@ -97,10 +97,10 @@ bb66.i:                                           ; Unreachable
 
 @g = external global i64, align 8
 
-define ptr @test3() {
+define ptr @test3(i1 %arg) {
 do.end17.i:
   %tmp18.i = load ptr, ptr undef
-  br i1 undef, label %do.body36.i, label %if.then21.i
+  br i1 %arg, label %do.body36.i, label %if.then21.i
 
 if.then21.i:
   ret ptr undef
@@ -110,7 +110,7 @@ do.body36.i:
   %add.ptr39.sum.i = add i64 %ivar38.i, 8
   %tmp40.i = getelementptr inbounds i8, ptr %tmp18.i, i64 %add.ptr39.sum.i
   %tmp41.i = load i64, ptr %tmp40.i
-  br i1 undef, label %if.then48.i, label %do.body57.i
+  br i1 %arg, label %if.then48.i, label %do.body57.i
 
 if.then48.i:
   %call54.i = call i32 @foo2()
@@ -163,7 +163,7 @@ entry:
 
 %struct.type = type { i64, i32, i32 }
 
-define fastcc void @func() nounwind uwtable ssp align 2 {
+define fastcc void @func(i1 %arg) nounwind uwtable ssp align 2 {
 entry:
   br label %reachable.bb
 
@@ -171,7 +171,7 @@ entry:
 
 unreachable.bb:
   %gep.val = getelementptr inbounds %struct.type, ptr %gep.val, i64 1
-  br i1 undef, label %u2.bb, label %u1.bb
+  br i1 %arg, label %u2.bb, label %u1.bb
 
 u1.bb:
   store i64 -1, ptr %gep.val, align 8

diff  --git a/llvm/test/Transforms/GVN/equality-assume.ll b/llvm/test/Transforms/GVN/equality-assume.ll
index 510c64595af702..7474221be858a5 100644
--- a/llvm/test/Transforms/GVN/equality-assume.ll
+++ b/llvm/test/Transforms/GVN/equality-assume.ll
@@ -109,12 +109,12 @@ define i32 @test2(ptr %p, i32 %v) {
   ret i32 %load2
 }
 
-define i32 @test3(ptr %p, i32 %v) {
+define i32 @test3(ptr %p, i32 %v, i1 %arg) {
 ; CHECK-LABEL: @test3(
 ; CHECK-NEXT:    [[LOAD:%.*]] = load i32, ptr [[P:%.*]]
 ; CHECK-NEXT:    [[C:%.*]] = icmp eq i32 [[LOAD]], [[V:%.*]]
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[C]])
-; CHECK-NEXT:    br i1 undef, label [[TAKEN:%.*]], label [[MERGE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TAKEN:%.*]], label [[MERGE:%.*]]
 ; CHECK:       taken:
 ; CHECK-NEXT:    br label [[MERGE]]
 ; CHECK:       merge:
@@ -123,16 +123,16 @@ define i32 @test3(ptr %p, i32 %v) {
   %load = load i32, ptr %p
   %c = icmp eq i32 %load, %v
   call void @llvm.assume(i1 %c)
-  br i1 undef, label %taken, label %merge
+  br i1 %arg, label %taken, label %merge
 taken:
   br label %merge
 merge:
   ret i32 %load
 }
 
-define i32 @trivial_constants(ptr %p) {
+define i32 @trivial_constants(ptr %p, i1 %arg) {
 ; CHECK-LABEL: @trivial_constants(
-; CHECK-NEXT:    br i1 undef, label [[TAKEN:%.*]], label [[MERGE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TAKEN:%.*]], label [[MERGE:%.*]]
 ; CHECK:       taken:
 ; CHECK-NEXT:    br label [[MERGE]]
 ; CHECK:       merge:
@@ -140,17 +140,17 @@ define i32 @trivial_constants(ptr %p) {
 ;
   %c = icmp eq i32 0, 0
   call void @llvm.assume(i1 %c)
-  br i1 undef, label %taken, label %merge
+  br i1 %arg, label %taken, label %merge
 taken:
   br label %merge
 merge:
   ret i32 0
 }
 
-define i32 @conflicting_constants(ptr %p) {
+define i32 @conflicting_constants(ptr %p, i1 %arg) {
 ; CHECK-LABEL: @conflicting_constants(
 ; CHECK-NEXT:    store i8 poison, ptr null
-; CHECK-NEXT:    br i1 undef, label [[TAKEN:%.*]], label [[MERGE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TAKEN:%.*]], label [[MERGE:%.*]]
 ; CHECK:       taken:
 ; CHECK-NEXT:    br label [[MERGE]]
 ; CHECK:       merge:
@@ -158,7 +158,7 @@ define i32 @conflicting_constants(ptr %p) {
 ;
   %c = icmp eq i32 0, 5
   call void @llvm.assume(i1 %c)
-  br i1 undef, label %taken, label %merge
+  br i1 %arg, label %taken, label %merge
 taken:
   br label %merge
 merge:

diff  --git a/llvm/test/Transforms/GVN/pre-new-inst.ll b/llvm/test/Transforms/GVN/pre-new-inst.ll
index 209a4f47cac4c0..8e8cea0467d82b 100644
--- a/llvm/test/Transforms/GVN/pre-new-inst.ll
+++ b/llvm/test/Transforms/GVN/pre-new-inst.ll
@@ -1,10 +1,10 @@
 ; RUN: opt -passes=gvn -S %s | FileCheck %s
 
 %MyStruct = type { i32, i32 }
-define i8 @foo(i64 %in, ptr %arr) {
+define i8 @foo(i64 %in, ptr %arr, i1 %arg) {
   %addr = alloca %MyStruct
   %dead = trunc i64 %in to i32
-  br i1 undef, label %next, label %tmp
+  br i1 %arg, label %next, label %tmp
 
 tmp:
   call void @bar()

diff  --git a/llvm/test/Transforms/GVN/stale-loop-info.ll b/llvm/test/Transforms/GVN/stale-loop-info.ll
index 1d858c306673fb..3d6ec67594fbc3 100644
--- a/llvm/test/Transforms/GVN/stale-loop-info.ll
+++ b/llvm/test/Transforms/GVN/stale-loop-info.ll
@@ -13,7 +13,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 ; Function Attrs: argmemonly
 declare void @snork.1(ptr) local_unnamed_addr #0
 
-define hidden zeroext i1 @eggs(ptr %arg, i1 %arg2) unnamed_addr align 2 {
+define hidden zeroext i1 @eggs(ptr %arg, i1 %arg2, i1 %arg3) unnamed_addr align 2 {
 bb:
   br i1 %arg2, label %bb14, label %bb3
 
@@ -25,7 +25,7 @@ bb6:                                              ; preds = %bb12, %bb3
   br label %bb7
 
 bb7:                                              ; preds = %bb6
-  br i1 undef, label %bb11, label %bb8
+  br i1 %arg3, label %bb11, label %bb8
 
 bb8:                                              ; preds = %bb7
   %tmp9 = load ptr, ptr %tmp, align 8

diff  --git a/llvm/test/Transforms/GVN/unreachable_block_infinite_loop.ll b/llvm/test/Transforms/GVN/unreachable_block_infinite_loop.ll
index 67fae22a59d15d..5de5e03c6b55c8 100644
--- a/llvm/test/Transforms/GVN/unreachable_block_infinite_loop.ll
+++ b/llvm/test/Transforms/GVN/unreachable_block_infinite_loop.ll
@@ -12,32 +12,32 @@ unreachable_block:
     ret i32 %a
 }
 
-define i32 @pr23096_test0() {
+define i32 @pr23096_test0(i1 %arg, ptr %arg2) {
 entry:
   br label %bb0
 
 bb1:
   %ptr1 = ptrtoint ptr %ptr2 to i64
   %ptr2 = inttoptr i64 %ptr1 to ptr
-  br i1 undef, label %bb0, label %bb1
+  br i1 %arg, label %bb0, label %bb1
 
 bb0:
-  %phi = phi ptr [ undef, %entry ], [ %ptr2, %bb1 ]
+  %phi = phi ptr [ %arg2, %entry ], [ %ptr2, %bb1 ]
   %load = load i32, ptr %phi
   ret i32 %load
 }
 
-define i32 @pr23096_test1() {
+define i32 @pr23096_test1(i1 %arg, ptr %arg2) {
 entry:
   br label %bb0
 
 bb1:
   %ptr1 = getelementptr i32, ptr %ptr2, i32 0
   %ptr2 = getelementptr i32, ptr %ptr1, i32 0
-  br i1 undef, label %bb0, label %bb1
+  br i1 %arg, label %bb0, label %bb1
 
 bb0:
-  %phi = phi ptr [ undef, %entry ], [ %ptr2, %bb1 ]
+  %phi = phi ptr [ %arg2, %entry ], [ %ptr2, %bb1 ]
   %load = load i32, ptr %phi
   ret i32 %load
 }

diff  --git a/llvm/test/Transforms/GVNHoist/hoist-call.ll b/llvm/test/Transforms/GVNHoist/hoist-call.ll
index 7c1fe26a827ccf..01e6029c90b002 100644
--- a/llvm/test/Transforms/GVNHoist/hoist-call.ll
+++ b/llvm/test/Transforms/GVNHoist/hoist-call.ll
@@ -2,14 +2,14 @@
 ; RUN: opt -S -passes=gvn-hoist < %s | FileCheck %s
 
 ; Check that the call and fcmp are hoisted.
-define void @fun(float %__b) minsize {
+define void @fun(float %__b, i1 %arg) minsize {
 ; CHECK-LABEL: @fun(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[IF_THEN:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    [[TMP0:%.*]] = call float @llvm.fabs.f32(float [[__B:%.*]])
 ; CHECK-NEXT:    [[CMPINF7:%.*]] = fcmp oeq float [[TMP0]], 0x7FF0000000000000
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN8:%.*]], label [[LOR_LHS_FALSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN8:%.*]], label [[LOR_LHS_FALSE:%.*]]
 ; CHECK:       lor.lhs.false:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       if.then8:
@@ -19,7 +19,7 @@ entry:
   br label %if.then
 
 if.then:                                          ; preds = %entry
-  br i1 undef, label %if.then8, label %lor.lhs.false
+  br i1 %arg, label %if.then8, label %lor.lhs.false
 
 lor.lhs.false:                                    ; preds = %if.then
   %0 = call float @llvm.fabs.f32(float %__b) #2

diff  --git a/llvm/test/Transforms/GVNHoist/hoist-mssa.ll b/llvm/test/Transforms/GVNHoist/hoist-mssa.ll
index e26f7c439b044e..da2582687258a0 100644
--- a/llvm/test/Transforms/GVNHoist/hoist-mssa.ll
+++ b/llvm/test/Transforms/GVNHoist/hoist-mssa.ll
@@ -7,22 +7,22 @@
 
 @optind = external global i32, align 4
 
-define void @getopt() {
+define void @getopt(i1 %arg) {
 bb:
   br label %bb1
 
 bb1:                                              ; preds = %bb
-  br i1 undef, label %bb2, label %bb3
+  br i1 %arg, label %bb2, label %bb3
 
 bb2:                                              ; preds = %bb1
   br label %bb13
 
 bb3:                                              ; preds = %bb1
-  br i1 undef, label %bb4, label %bb9
+  br i1 %arg, label %bb4, label %bb9
 
 bb4:                                              ; preds = %bb3
   %tmp = load i32, ptr @optind, align 4
-  br i1 undef, label %bb5, label %bb7
+  br i1 %arg, label %bb5, label %bb7
 
 bb5:                                              ; preds = %bb4
   %tmp6 = add nsw i32 %tmp, 1

diff  --git a/llvm/test/Transforms/GVNHoist/hoist-simplify-phi.ll b/llvm/test/Transforms/GVNHoist/hoist-simplify-phi.ll
index 6a7109af78c352..f48e423b6a2ff5 100644
--- a/llvm/test/Transforms/GVNHoist/hoist-simplify-phi.ll
+++ b/llvm/test/Transforms/GVNHoist/hoist-simplify-phi.ll
@@ -10,18 +10,18 @@ target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 
 %s = type { i32, ptr, [3 x i8], i8 }
 
-define void @test() {
+define void @test(i1 %arg) {
 entry:
   br label %cond.end118
 
 cond.end118:                                      ; preds = %entry
-  br i1 undef, label %cleanup, label %if.end155
+  br i1 %arg, label %cleanup, label %if.end155
 
 if.end155:                                        ; preds = %cond.end118
   br label %while.cond
 
 while.cond:                                       ; preds = %while.body, %if.end155
-  br i1 undef, label %while.end, label %while.body
+  br i1 %arg, label %while.end, label %while.body
 
 while.body:                                       ; preds = %while.cond
   br label %while.cond
@@ -36,7 +36,7 @@ if.then174:                                       ; preds = %while.end
   unreachable
 
 if.else218:                                       ; preds = %while.end
-  br i1 undef, label %if.then226, label %if.else326
+  br i1 %arg, label %if.then226, label %if.else326
 
 if.then226:                                       ; preds = %if.else218
   %0 = load i32, ptr undef, align 4

diff  --git a/llvm/test/Transforms/GVNHoist/hoist-very-busy.ll b/llvm/test/Transforms/GVNHoist/hoist-very-busy.ll
index 44b48fadc112a0..0ef92c53a10976 100644
--- a/llvm/test/Transforms/GVNHoist/hoist-very-busy.ll
+++ b/llvm/test/Transforms/GVNHoist/hoist-very-busy.ll
@@ -38,12 +38,12 @@ attributes #0 = { noreturn nounwind }
 ; CHECK: store
 ; CHECK-NOT: store
 
-define void @fun() {
+define void @fun(i1 %arg) {
 entry:
   br label %if.then
 
 if.then:                                          ; preds = %entry
-  br i1 undef, label %sw0, label %sw1
+  br i1 %arg, label %sw0, label %sw1
 
 sw0:
   store i32 1, ptr @G

diff  --git a/llvm/test/Transforms/GVNHoist/non-trivial-phi.ll b/llvm/test/Transforms/GVNHoist/non-trivial-phi.ll
index b02e628657ebeb..7e1b2bd8f84421 100644
--- a/llvm/test/Transforms/GVNHoist/non-trivial-phi.ll
+++ b/llvm/test/Transforms/GVNHoist/non-trivial-phi.ll
@@ -5,7 +5,7 @@
 
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 
-define void @f(ptr %p) {
+define void @f(ptr %p, i1 %arg) {
 entry:
   switch i4 undef, label %if.then30 [
     i4 4, label %if.end
@@ -16,7 +16,7 @@ if.end:
   br label %if.end19
 
 if.end19:
-  br i1 undef, label %e, label %e.thread
+  br i1 %arg, label %e, label %e.thread
 
 e.thread:
   store i8 0, ptr %p, align 4

diff  --git a/llvm/test/Transforms/GVNHoist/pr30216.ll b/llvm/test/Transforms/GVNHoist/pr30216.ll
index fbd443f141dcab..58402167b827a6 100644
--- a/llvm/test/Transforms/GVNHoist/pr30216.ll
+++ b/llvm/test/Transforms/GVNHoist/pr30216.ll
@@ -6,10 +6,10 @@
 @A = external global i8
 @B = external global ptr
 
-define ptr @Foo() {
-; CHECK-LABEL: define ptr @Foo() {
+define ptr @Foo(i1 %arg) {
+; CHECK-LABEL: define ptr @Foo(i1 %arg) {
 ; CHECK-NEXT:    store i8 0, ptr @A, align 1
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    store ptr null, ptr @B, align 8
 ; CHECK-NEXT:    ret ptr null
@@ -19,7 +19,7 @@ define ptr @Foo() {
 ; CHECK-NEXT:    ret ptr [[TMP1]]
 ;
   store i8 0, ptr @A
-  br i1 undef, label %if.then, label %if.else
+  br i1 %arg, label %if.then, label %if.else
 
 if.then:
   store ptr null, ptr @B
@@ -35,10 +35,10 @@ if.else:
 
 @GlobalVar = internal global i8 0
 
-define ptr @Fun() {
-; CHECK-LABEL: define ptr @Fun() {
+define ptr @Fun(i1 %arg) {
+; CHECK-LABEL: define ptr @Fun(i1 %arg) {
 ; CHECK-NEXT:    store i8 0, ptr @A, align 1
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    store ptr null, ptr @B, align 8
 ; CHECK-NEXT:    ret ptr null
@@ -49,7 +49,7 @@ define ptr @Fun() {
 ; CHECK-NEXT:    ret ptr [[TMP1]]
 ;
   store i8 0, ptr @A
-  br i1 undef, label %if.then, label %if.else
+  br i1 %arg, label %if.then, label %if.else
 
 if.then:
   store ptr null, ptr @B

diff  --git a/llvm/test/Transforms/GVNHoist/pr36787.ll b/llvm/test/Transforms/GVNHoist/pr36787.ll
index 9bda6ff29e1862..f060f74d05f11e 100644
--- a/llvm/test/Transforms/GVNHoist/pr36787.ll
+++ b/llvm/test/Transforms/GVNHoist/pr36787.ll
@@ -12,7 +12,7 @@ declare void @f2()
 
 ;CHECK-LABEL: @func
 
-define void @func() personality ptr @gxx_personality {
+define void @func(i1 %arg) personality ptr @gxx_personality {
   invoke void @f0()
           to label %3 unwind label %1
 
@@ -23,7 +23,7 @@ define void @func() personality ptr @gxx_personality {
   br label %16
 
 3:
-  br i1 undef, label %4, label %10
+  br i1 %arg, label %4, label %10
 
 ;CHECK:       4:
 ;CHECK-NEXT:    %5 = load ptr, ptr undef, align 8

diff  --git a/llvm/test/Transforms/GVNSink/dither.ll b/llvm/test/Transforms/GVNSink/dither.ll
index 445eceed809202..2c16667b0e907f 100644
--- a/llvm/test/Transforms/GVNSink/dither.ll
+++ b/llvm/test/Transforms/GVNSink/dither.ll
@@ -7,12 +7,12 @@
 
 ; CHECK-LABEL: @hoge
 ; CHECK-NOT: bb18.gvnsink.split
-define void @hoge() {
+define void @hoge(i1 %arg) {
 bb:
-  br i1 undef, label %bb4, label %bb11
+  br i1 %arg, label %bb4, label %bb11
 
 bb4:                                              ; preds = %bb3
-  br i1 undef, label %bb6, label %bb8
+  br i1 %arg, label %bb6, label %bb8
 
 bb6:                                              ; preds = %bb5
   %tmp = zext i16 undef to i64
@@ -24,7 +24,7 @@ bb8:                                              ; preds = %bb5
   br label %bb18
 
 bb11:                                             ; preds = %bb10
-  br i1 undef, label %bb12, label %bb15
+  br i1 %arg, label %bb12, label %bb15
 
 bb12:                                             ; preds = %bb11
   %tmp13 = zext i16 undef to i64

diff  --git a/llvm/test/Transforms/GVNSink/sink-common-code.ll b/llvm/test/Transforms/GVNSink/sink-common-code.ll
index 5c83a19c35cf12..c77a85f95f1a57 100644
--- a/llvm/test/Transforms/GVNSink/sink-common-code.ll
+++ b/llvm/test/Transforms/GVNSink/sink-common-code.ll
@@ -762,13 +762,13 @@ if.end:
 ; CHECK-LABEL: test_pr36954
 ; CHECK-NOT: xor
 ; PR36954 reproducer containing self referencing instruction shouldn't crash GVNSink pass.
-define void @test_pr36954() {
+define void @test_pr36954(i1 %arg) {
 bb1:
   %i2 = trunc i32 undef to i8
   br label %bb2
 
 bb2:
-  br i1 undef, label %bb2, label %exit
+  br i1 %arg, label %bb2, label %exit
 
 bb4.critedge:
   %i6 = sub i8 %i2, undef

diff  --git a/llvm/test/Transforms/GVNSink/struct.ll b/llvm/test/Transforms/GVNSink/struct.ll
index 1f0fa0640d72a8..26ac71860ccdcc 100644
--- a/llvm/test/Transforms/GVNSink/struct.ll
+++ b/llvm/test/Transforms/GVNSink/struct.ll
@@ -5,12 +5,12 @@
 
 ; Struct indices cannot be variant.
 
-; CHECK-LABEL: @f() {
+; CHECK-LABEL: @f(i1 %arg) {
 ; CHECK: getelementptr
 ; CHECK: getelementptr
-define void @f() {
+define void @f(i1 %arg) {
 bb:
-  br i1 undef, label %bb2, label %bb1
+  br i1 %arg, label %bb2, label %bb1
 
 bb1:                                              ; preds = %bb
   %tmp = getelementptr inbounds %struct, ptr null, i64 0, i32 1
@@ -27,12 +27,12 @@ bb4:                                              ; preds = %bb2, %bb1
 
 ; Struct indices cannot be variant.
 
-; CHECK-LABEL: @g() {
+; CHECK-LABEL: @g(i1 %arg) {
 ; CHECK: getelementptr
 ; CHECK: getelementptr
-define void @g() {
+define void @g(i1 %arg) {
 bb:
-  br i1 undef, label %bb2, label %bb1
+  br i1 %arg, label %bb2, label %bb1
 
 bb1:                                              ; preds = %bb
   %tmp = getelementptr inbounds %struct2, ptr null, i64 0, i32 0, i32 1
@@ -50,12 +50,12 @@ bb4:                                              ; preds = %bb2, %bb1
 
 ; ... but the first parameter to a GEP can.
 
-; CHECK-LABEL: @h() {
+; CHECK-LABEL: @h(i1 %arg) {
 ; CHECK: getelementptr
 ; CHECK-NOT: getelementptr
-define void @h() {
+define void @h(i1 %arg) {
 bb:
-  br i1 undef, label %bb2, label %bb1
+  br i1 %arg, label %bb2, label %bb1
 
 bb1:                                              ; preds = %bb
   %tmp = getelementptr inbounds %struct, ptr null, i32 1, i32 0

diff  --git a/llvm/test/Transforms/GuardWidening/basic.ll b/llvm/test/Transforms/GuardWidening/basic.ll
index 096ea9057915c6..355f70e4eb5434 100644
--- a/llvm/test/Transforms/GuardWidening/basic.ll
+++ b/llvm/test/Transforms/GuardWidening/basic.ll
@@ -22,13 +22,13 @@ entry:
 }
 
 ; Same as @f_0, but with using a more general notion of postdominance.
-define void @f_1(i1 %cond_0, i1 %cond_1) {
+define void @f_1(i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_1(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_1_GW_FR:%.*]] = freeze i1 [[COND_1:%.*]]
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_0:%.*]], [[COND_1_GW_FR]]
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    br label [[MERGE:%.*]]
 ; CHECK:       right:
@@ -39,7 +39,7 @@ define void @f_1(i1 %cond_0, i1 %cond_1) {
 entry:
 
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
   br label %merge
@@ -54,7 +54,7 @@ merge:
 
 ; Like @f_1, but we have some code we need to hoist before we can
 ; widen a dominanting check.
-define void @f_2(i32 %a, i32 %b) {
+define void @f_2(i32 %a, i32 %b, i1 %arg) {
 ; CHECK-LABEL: @f_2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[B_GW_FR:%.*]] = freeze i32 [[B:%.*]]
@@ -62,7 +62,7 @@ define void @f_2(i32 %a, i32 %b) {
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp ult i32 [[B_GW_FR]], 10
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_0]], [[COND_1]]
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    br label [[MERGE:%.*]]
 ; CHECK:       right:
@@ -74,7 +74,7 @@ entry:
 
   %cond_0 = icmp ult i32 %a, 10
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
   br label %merge
@@ -90,12 +90,12 @@ merge:
 
 ; Negative test: don't hoist stuff out of control flow
 ; indiscriminately, since that can make us do more work than needed.
-define void @f_3(i32 %a, i32 %b) {
+define void @f_3(i32 %a, i32 %b, i1 %arg) {
 ; CHECK-LABEL: @f_3(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 10
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_0]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp ult i32 [[B:%.*]], 10
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_1]]) [ "deopt"() ]
@@ -107,7 +107,7 @@ entry:
 
   %cond_0 = icmp ult i32 %a, 10
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
 
@@ -122,7 +122,7 @@ right:
 ; But hoisting out of control flow is fine if it makes a loop computed
 ; condition loop invariant.  This behavior may require some tuning in
 ; the future.
-define void @f_4(i32 %a, i32 %b) {
+define void @f_4(i32 %a, i32 %b, i1 %arg) {
 ; CHECK-LABEL: @f_4(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[B_GW_FR:%.*]] = freeze i32 [[B:%.*]]
@@ -130,9 +130,9 @@ define void @f_4(i32 %a, i32 %b) {
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp ult i32 [[B_GW_FR]], 10
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_0]], [[COND_1]]
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LOOP:%.*]], label [[LEAVE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP:%.*]], label [[LEAVE:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[LEAVE]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[LEAVE]]
 ; CHECK:       leave:
 ; CHECK-NEXT:    ret void
 ;
@@ -140,12 +140,12 @@ entry:
 
   %cond_0 = icmp ult i32 %a, 10
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %loop, label %leave
+  br i1 %arg, label %loop, label %leave
 
 loop:
   %cond_1 = icmp ult i32 %b, 10
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]
-  br i1 undef, label %loop, label %leave
+  br i1 %arg, label %loop, label %leave
 
 leave:
   ret void
@@ -153,13 +153,13 @@ leave:
 
 ; Hoisting out of control flow is also fine if we can widen the
 ; dominating check without doing any extra work.
-define void @f_5(i32 %a) {
+define void @f_5(i32 %a, i1 %arg) {
 ; CHECK-LABEL: @f_5(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ugt i32 [[A:%.*]], 7
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = icmp uge i32 [[A]], 11
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp ugt i32 [[A]], 10
 ; CHECK-NEXT:    ret void
@@ -170,7 +170,7 @@ entry:
 
   %cond_0 = icmp ugt i32 %a, 7
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
   %cond_1 = icmp ugt i32 %a, 10
@@ -205,7 +205,7 @@ entry:
 
 ; All else equal, we try to widen the earliest guard we can.  This
 ; heuristic can use some tuning.
-define void @f_7(i32 %a, ptr %cond_buf) {
+define void @f_7(i32 %a, ptr %cond_buf, i1 %arg) {
 ; CHECK-LABEL: @f_7(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A_GW_FR:%.*]] = freeze i32 [[A:%.*]]
@@ -215,7 +215,7 @@ define void @f_7(i32 %a, ptr %cond_buf) {
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
 ; CHECK-NEXT:    [[COND_2:%.*]] = load volatile i1, ptr [[COND_BUF]], align 1
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_2]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    br label [[LEFT]]
 ; CHECK:       right:
@@ -227,7 +227,7 @@ entry:
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]
   %cond_2 = load volatile i1, ptr %cond_buf
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_2) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
   %cond_3 = icmp ult i32 %a, 7
@@ -241,19 +241,19 @@ right:
 ; In this case the earliest dominating guard is in a loop, and we
 ; don't want to put extra work in there.  This heuristic can use some
 ; tuning.
-define void @f_8(i32 %a, i1 %cond_1, i1 %cond_2) {
+define void @f_8(i32 %a, i1 %cond_1, i1 %cond_2, i1 %arg) {
 ; CHECK-LABEL: @f_8(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A_GW_FR:%.*]] = freeze i32 [[A:%.*]]
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_1:%.*]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[LEAVE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[LEAVE:%.*]]
 ; CHECK:       leave:
 ; CHECK-NEXT:    [[COND_3:%.*]] = icmp ult i32 [[A_GW_FR]], 7
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_2:%.*]], [[COND_3]]
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LOOP2:%.*]], label [[LEAVE2:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP2:%.*]], label [[LEAVE2:%.*]]
 ; CHECK:       loop2:
 ; CHECK-NEXT:    br label [[LOOP2]]
 ; CHECK:       leave2:
@@ -264,12 +264,12 @@ entry:
 
 loop:
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]
-  br i1 undef, label %loop, label %leave
+  br i1 %arg, label %loop, label %leave
 
 leave:
 
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_2) [ "deopt"() ]
-  br i1 undef, label %loop2, label %leave2
+  br i1 %arg, label %loop2, label %leave2
 
 loop2:
   %cond_3 = icmp ult i32 %a, 7
@@ -282,13 +282,13 @@ leave2:
 
 ; In cases like these where there isn't any "obviously profitable"
 ; widening sites, we refuse to do anything.
-define void @f_9(i32 %a, i1 %cond_0, i1 %cond_1) {
+define void @f_9(i32 %a, i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_9(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FIRST_LOOP:%.*]]
 ; CHECK:       first_loop:
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_0:%.*]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[FIRST_LOOP]], label [[SECOND_LOOP:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FIRST_LOOP]], label [[SECOND_LOOP:%.*]]
 ; CHECK:       second_loop:
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_1:%.*]]) [ "deopt"() ]
 ; CHECK-NEXT:    br label [[SECOND_LOOP]]
@@ -299,7 +299,7 @@ entry:
 first_loop:
 
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %first_loop, label %second_loop
+  br i1 %arg, label %first_loop, label %second_loop
 
 second_loop:
 
@@ -309,13 +309,13 @@ second_loop:
 
 ; Same situation as in @f_9: no "obviously profitable" widening sites,
 ; so we refuse to do anything.
-define void @f_10(i32 %a, i1 %cond_0, i1 %cond_1) {
+define void @f_10(i32 %a, i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_10(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_0:%.*]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[NO_LOOP:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[NO_LOOP:%.*]]
 ; CHECK:       no_loop:
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_1:%.*]]) [ "deopt"() ]
 ; CHECK-NEXT:    ret void
@@ -326,7 +326,7 @@ entry:
 loop:
 
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %loop, label %no_loop
+  br i1 %arg, label %loop, label %no_loop
 
 no_loop:
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]
@@ -335,7 +335,7 @@ no_loop:
 
 ; With guards in loops, we're okay hoisting out the guard into the
 ; containing loop.
-define void @f_11(i32 %a, i1 %cond_0, i1 %cond_1) {
+define void @f_11(i32 %a, i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_11(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_1_GW_FR:%.*]] = freeze i1 [[COND_1:%.*]]
@@ -343,7 +343,7 @@ define void @f_11(i32 %a, i1 %cond_0, i1 %cond_1) {
 ; CHECK:       inner:
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_0:%.*]], [[COND_1_GW_FR]]
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[INNER]], label [[OUTER:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[INNER]], label [[OUTER:%.*]]
 ; CHECK:       outer:
 ; CHECK-NEXT:    br label [[INNER]]
 ;
@@ -353,7 +353,7 @@ entry:
 inner:
 
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %inner, label %outer
+  br i1 %arg, label %inner, label %outer
 
 outer:
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]
@@ -441,13 +441,13 @@ entry:
   ret void
 }
 
-define void @f_13(i32 %a) {
+define void @f_13(i32 %a, i1 %arg) {
 ; CHECK-LABEL: @f_13(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 14
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = icmp ult i32 [[A]], 10
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp slt i32 [[A]], 10
 ; CHECK-NEXT:    ret void
@@ -458,7 +458,7 @@ entry:
 
   %cond_0 = icmp ult i32 %a, 14
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
   %cond_1 = icmp slt i32 %a, 10
@@ -469,12 +469,12 @@ right:
   ret void
 }
 
-define void @f_14(i32 %a) {
+define void @f_14(i32 %a, i1 %arg) {
 ; CHECK-LABEL: @f_14(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 14
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_0]]) [ "deopt"() ]
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp sgt i32 [[A]], 10
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[COND_1]]) [ "deopt"() ]
@@ -486,7 +486,7 @@ entry:
 
   %cond_0 = icmp ult i32 %a, 14
   call void(i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:
 

diff  --git a/llvm/test/Transforms/GuardWidening/basic_widenable_condition_guards.ll b/llvm/test/Transforms/GuardWidening/basic_widenable_condition_guards.ll
index b972814676a1e0..310c4a820c8a93 100644
--- a/llvm/test/Transforms/GuardWidening/basic_widenable_condition_guards.ll
+++ b/llvm/test/Transforms/GuardWidening/basic_widenable_condition_guards.ll
@@ -48,7 +48,7 @@ guarded1:                                         ; preds = %guarded
 }
 
 ; Same as @f_0, but with using a more general notion of postdominance.
-define void @f_1(i1 %cond_0, i1 %cond_1) {
+define void @f_1(i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_1(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_1_GW_FR:%.*]] = freeze i1 [[COND_1:%.*]]
@@ -60,7 +60,7 @@ define void @f_1(i1 %cond_0, i1 %cond_1) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    br label [[MERGE:%.*]]
 ; CHECK:       right:
@@ -85,7 +85,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded
   br label %merge
@@ -108,7 +108,7 @@ guarded1:                                         ; preds = %merge
 
 ; Like @f_1, but we have some code we need to hoist before we can
 ; widen a dominanting check.
-define void @f_2(i32 %a, i32 %b) {
+define void @f_2(i32 %a, i32 %b, i1 %arg) {
 ; CHECK-LABEL: @f_2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[B_GW_FR:%.*]] = freeze i32 [[B:%.*]]
@@ -122,7 +122,7 @@ define void @f_2(i32 %a, i32 %b) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    br label [[MERGE:%.*]]
 ; CHECK:       right:
@@ -148,7 +148,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded
   br label %merge
@@ -172,7 +172,7 @@ guarded1:                                         ; preds = %merge
 
 ; Negative test: don't hoist stuff out of control flow
 ; indiscriminately, since that can make us do more work than needed.
-define void @f_3(i32 %a, i32 %b) {
+define void @f_3(i32 %a, i32 %b, i1 %arg) {
 ; CHECK-LABEL: @f_3(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 10
@@ -183,7 +183,7 @@ define void @f_3(i32 %a, i32 %b) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp ult i32 [[B:%.*]], 10
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
@@ -208,7 +208,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded
   %cond_1 = icmp ult i32 %b, 10
@@ -230,7 +230,7 @@ right:                                            ; preds = %guarded
 ; But hoisting out of control flow is fine if it makes a loop computed
 ; condition loop invariant.  This behavior may require some tuning in
 ; the future.
-define void @f_4(i32 %a, i32 %b) {
+define void @f_4(i32 %a, i32 %b, i1 %arg) {
 ; CHECK-LABEL: @f_4(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[B_GW_FR:%.*]] = freeze i32 [[B:%.*]]
@@ -244,7 +244,7 @@ define void @f_4(i32 %a, i32 %b) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LOOP:%.*]], label [[LEAVE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP:%.*]], label [[LEAVE:%.*]]
 ; CHECK:       loop:
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
 ; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND4:%.*]] = and i1 [[COND_1]], [[WIDENABLE_COND3]]
@@ -253,7 +253,7 @@ define void @f_4(i32 %a, i32 %b) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded1:
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[LEAVE]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[LEAVE]]
 ; CHECK:       leave:
 ; CHECK-NEXT:    ret void
 ;
@@ -268,7 +268,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %loop, label %leave
+  br i1 %arg, label %loop, label %leave
 
 loop:                                             ; preds = %guarded1, %guarded
   %cond_1 = icmp ult i32 %b, 10
@@ -281,7 +281,7 @@ deopt2:                                           ; preds = %loop
   ret void
 
 guarded1:                                         ; preds = %loop
-  br i1 undef, label %loop, label %leave
+  br i1 %arg, label %loop, label %leave
 
 leave:                                            ; preds = %guarded1, %guarded
   ret void
@@ -289,7 +289,7 @@ leave:                                            ; preds = %guarded1, %guarded
 
 ; Hoisting out of control flow is also fine if we can widen the
 ; dominating check without doing any extra work.
-define void @f_5(i32 %a) {
+define void @f_5(i32 %a, i1 %arg) {
 ; CHECK-LABEL: @f_5(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ugt i32 [[A:%.*]], 7
@@ -301,7 +301,7 @@ define void @f_5(i32 %a) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp ugt i32 [[A]], 10
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
@@ -326,7 +326,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded
   %cond_1 = icmp ugt i32 %a, 10
@@ -397,7 +397,7 @@ guarded1:                                         ; preds = %guarded
 
 ; All else equal, we try to widen the earliest guard we can.  This
 ; heuristic can use some tuning.
-define void @f_7(i32 %a, ptr %cond_buf) {
+define void @f_7(i32 %a, ptr %cond_buf, i1 %arg) {
 ; CHECK-LABEL: @f_7(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A_GW_FR:%.*]] = freeze i32 [[A:%.*]]
@@ -419,7 +419,7 @@ define void @f_7(i32 %a, ptr %cond_buf) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded1:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[WIDENABLE_COND7:%.*]] = call i1 @llvm.experimental.widenable.condition()
 ; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND8:%.*]] = and i1 [[COND_3]], [[WIDENABLE_COND7]]
@@ -453,7 +453,7 @@ deopt2:                                           ; preds = %guarded
   ret void
 
 guarded1:                                         ; preds = %guarded
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded5, %guarded1
   %cond_3 = icmp ult i32 %a, 7
@@ -475,7 +475,7 @@ right:                                            ; preds = %guarded1
 ; In this case the earliest dominating guard is in a loop, and we
 ; don't want to put extra work in there.  This heuristic can use some
 ; tuning.
-define void @f_8(i32 %a, i1 %cond_1, i1 %cond_2) {
+define void @f_8(i32 %a, i1 %cond_1, i1 %cond_2, i1 %arg) {
 ; CHECK-LABEL: @f_8(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A_GW_FR:%.*]] = freeze i32 [[A:%.*]]
@@ -488,7 +488,7 @@ define void @f_8(i32 %a, i1 %cond_1, i1 %cond_2) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[LEAVE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[LEAVE:%.*]]
 ; CHECK:       leave:
 ; CHECK-NEXT:    [[COND_3:%.*]] = icmp ult i32 [[A_GW_FR]], 7
 ; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_2:%.*]], [[COND_3]]
@@ -499,7 +499,7 @@ define void @f_8(i32 %a, i1 %cond_1, i1 %cond_2) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded1:
-; CHECK-NEXT:    br i1 undef, label [[LOOP2:%.*]], label [[LEAVE2:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP2:%.*]], label [[LEAVE2:%.*]]
 ; CHECK:       loop2:
 ; CHECK-NEXT:    [[WIDENABLE_COND7:%.*]] = call i1 @llvm.experimental.widenable.condition()
 ; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND8:%.*]] = and i1 [[COND_3]], [[WIDENABLE_COND7]]
@@ -525,7 +525,7 @@ deopt:                                            ; preds = %loop
   ret void
 
 guarded:                                          ; preds = %loop
-  br i1 undef, label %loop, label %leave
+  br i1 %arg, label %loop, label %leave
 
 leave:                                            ; preds = %guarded
   %widenable_cond3 = call i1 @llvm.experimental.widenable.condition()
@@ -537,7 +537,7 @@ deopt2:                                           ; preds = %leave
   ret void
 
 guarded1:                                         ; preds = %leave
-  br i1 undef, label %loop2, label %leave2
+  br i1 %arg, label %loop2, label %leave2
 
 loop2:                                            ; preds = %guarded5, %guarded1
   %cond_3 = icmp ult i32 %a, 7
@@ -558,7 +558,7 @@ leave2:                                           ; preds = %guarded1
 
 ; In cases like these where there isn't any "obviously profitable"
 ; widening sites, we refuse to do anything.
-define void @f_9(i32 %a, i1 %cond_0, i1 %cond_1) {
+define void @f_9(i32 %a, i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_9(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FIRST_LOOP:%.*]]
@@ -570,7 +570,7 @@ define void @f_9(i32 %a, i1 %cond_0, i1 %cond_1) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[FIRST_LOOP]], label [[SECOND_LOOP:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FIRST_LOOP]], label [[SECOND_LOOP:%.*]]
 ; CHECK:       second_loop:
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
 ; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND4:%.*]] = and i1 [[COND_1:%.*]], [[WIDENABLE_COND3]]
@@ -594,7 +594,7 @@ deopt:                                            ; preds = %first_loop
   ret void
 
 guarded:                                          ; preds = %first_loop
-  br i1 undef, label %first_loop, label %second_loop
+  br i1 %arg, label %first_loop, label %second_loop
 
 second_loop:                                      ; preds = %guarded1, %guarded
   %widenable_cond3 = call i1 @llvm.experimental.widenable.condition()
@@ -611,7 +611,7 @@ guarded1:                                         ; preds = %second_loop
 
 ; Same situation as in @f_9: no "obviously profitable" widening sites,
 ; so we refuse to do anything.
-define void @f_10(i32 %a, i1 %cond_0, i1 %cond_1) {
+define void @f_10(i32 %a, i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_10(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
@@ -623,7 +623,7 @@ define void @f_10(i32 %a, i1 %cond_0, i1 %cond_1) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[NO_LOOP:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[NO_LOOP:%.*]]
 ; CHECK:       no_loop:
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
 ; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND4:%.*]] = and i1 [[COND_1:%.*]], [[WIDENABLE_COND3]]
@@ -647,7 +647,7 @@ deopt:                                            ; preds = %loop
   ret void
 
 guarded:                                          ; preds = %loop
-  br i1 undef, label %loop, label %no_loop
+  br i1 %arg, label %loop, label %no_loop
 
 no_loop:                                          ; preds = %guarded
   %widenable_cond3 = call i1 @llvm.experimental.widenable.condition()
@@ -664,7 +664,7 @@ guarded1:                                         ; preds = %no_loop
 
 ; With guards in loops, we're okay hoisting out the guard into the
 ; containing loop.
-define void @f_11(i32 %a, i1 %cond_0, i1 %cond_1) {
+define void @f_11(i32 %a, i1 %cond_0, i1 %cond_1, i1 %arg) {
 ; CHECK-LABEL: @f_11(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_1_GW_FR:%.*]] = freeze i1 [[COND_1:%.*]]
@@ -687,9 +687,9 @@ define void @f_11(i32 %a, i1 %cond_0, i1 %cond_1) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded1:
-; CHECK-NEXT:    br i1 undef, label [[INNER]], label [[OUTER_LATCH:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[INNER]], label [[OUTER_LATCH:%.*]]
 ; CHECK:       outer_latch:
-; CHECK-NEXT:    br i1 undef, label [[OUTER_HEADER]], label [[EXIT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[OUTER_HEADER]], label [[EXIT:%.*]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret void
 ;
@@ -718,10 +718,10 @@ deopt2:                                           ; preds = %inner
   ret void
 
 guarded1:                                         ; preds = %inner
-  br i1 undef, label %inner, label %outer_latch
+  br i1 %arg, label %inner, label %outer_latch
 
 outer_latch:                                      ; preds = %guarded1
-  br i1 undef, label %outer_header, label %exit
+  br i1 %arg, label %outer_header, label %exit
 
 exit:                                             ; preds = %outer_latch
   ret void
@@ -834,7 +834,7 @@ guarded1:                                         ; preds = %guarded
   ret void
 }
 
-define void @f_13(i32 %a) {
+define void @f_13(i32 %a, i1 %arg) {
 ; CHECK-LABEL: @f_13(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 14
@@ -846,7 +846,7 @@ define void @f_13(i32 %a) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp slt i32 [[A]], 10
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
@@ -871,7 +871,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded
   %cond_1 = icmp slt i32 %a, 10
@@ -890,7 +890,7 @@ right:                                            ; preds = %guarded
   ret void
 }
 
-define void @f_14(i32 %a) {
+define void @f_14(i32 %a, i1 %arg) {
 ; CHECK-LABEL: @f_14(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 14
@@ -901,7 +901,7 @@ define void @f_14(i32 %a) {
 ; CHECK-NEXT:    call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
 ; CHECK-NEXT:    ret void
 ; CHECK:       guarded:
-; CHECK-NEXT:    br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LEFT:%.*]], label [[RIGHT:%.*]]
 ; CHECK:       left:
 ; CHECK-NEXT:    [[COND_1:%.*]] = icmp sgt i32 [[A]], 10
 ; CHECK-NEXT:    [[WIDENABLE_COND3:%.*]] = call i1 @llvm.experimental.widenable.condition()
@@ -926,7 +926,7 @@ deopt:                                            ; preds = %entry
   ret void
 
 guarded:                                          ; preds = %entry
-  br i1 undef, label %left, label %right
+  br i1 %arg, label %left, label %right
 
 left:                                             ; preds = %guarded
   %cond_1 = icmp sgt i32 %a, 10


        


More information about the llvm-commits mailing list