[llvm] [llvm] Remove `br i1 undef` from regression tests (PR #118419)

Lee Wei via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 19:49:11 PST 2024


https://github.com/leewei05 created https://github.com/llvm/llvm-project/pull/118419

This PR removes tests with `br i1 undef` under `llvm/tests/Transforms/ObjCARC, Reassociate, SCCP, SLPVectorizer...`. After this PR, I'll continue to fix tests under `llvm/tests/CodeGen`, which has more UB tests than `llvm/tests/Transforms`.

@nunoplopes @regehr 

>From 9aade4839f0996668dbbb00ed227e906bb038e18 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 19:18:04 -0700
Subject: [PATCH 1/9] Remove br i1 undef in ObjCARC directory

---
 llvm/test/Transforms/ObjCARC/allocas.ll       |  12 +-
 llvm/test/Transforms/ObjCARC/basic.ll         |  16 +-
 llvm/test/Transforms/ObjCARC/cfg-hazards.ll   |  98 ++--
 .../Transforms/ObjCARC/contract-testcases.ll  |  10 +-
 llvm/test/Transforms/ObjCARC/empty-block.ll   |   8 +-
 llvm/test/Transforms/ObjCARC/path-overflow.ll | 446 +++++++++---------
 6 files changed, 295 insertions(+), 295 deletions(-)

diff --git a/llvm/test/Transforms/ObjCARC/allocas.ll b/llvm/test/Transforms/ObjCARC/allocas.ll
index be829882ae3749..6fe2edf3e2dd48 100644
--- a/llvm/test/Transforms/ObjCARC/allocas.ll
+++ b/llvm/test/Transforms/ObjCARC/allocas.ll
@@ -109,16 +109,16 @@ entry:
 }
 
 
-; CHECK: define void @test1d(ptr %x)
+; CHECK: define void @test1d(ptr %x, i1 %arg)
 ; CHECK: @llvm.objc.retain(ptr %x)
 ; CHECK: @llvm.objc.retain(ptr %x)
 ; CHECK: @llvm.objc.release(ptr %y)
 ; CHECK: @llvm.objc.release(ptr %x)
 ; CHECK: ret void
 ; CHECK: }
-define void @test1d(ptr %x) {
+define void @test1d(ptr %x, i1 %arg) {
 entry:
-  br i1 undef, label %use_allocaA, label %use_allocaB
+  br i1 %arg, label %use_allocaA, label %use_allocaB
 
 use_allocaA:
   %allocaA = alloca ptr
@@ -141,16 +141,16 @@ exit:
   ret void
 }
 
-; CHECK: define void @test1e(ptr %x)
+; CHECK: define void @test1e(ptr %x, i1 %arg)
 ; CHECK: @llvm.objc.retain(ptr %x)
 ; CHECK: @llvm.objc.retain(ptr %x)
 ; CHECK: @llvm.objc.release(ptr %y)
 ; CHECK: @llvm.objc.release(ptr %x)
 ; CHECK: ret void
 ; CHECK: }
-define void @test1e(ptr %x) {
+define void @test1e(ptr %x, i1 %arg) {
 entry:
-  br i1 undef, label %use_allocaA, label %use_allocaB
+  br i1 %arg, label %use_allocaA, label %use_allocaB
 
 use_allocaA:
   %allocaA = alloca ptr, i32 4
diff --git a/llvm/test/Transforms/ObjCARC/basic.ll b/llvm/test/Transforms/ObjCARC/basic.ll
index 0ee59dc8ba6ab7..d461bc0af680d4 100644
--- a/llvm/test/Transforms/ObjCARC/basic.ll
+++ b/llvm/test/Transforms/ObjCARC/basic.ll
@@ -1761,13 +1761,13 @@ g:
 ; CHECK-LABEL: define void @test39(
 ; CHECK-NOT: @llvm.objc.
 ; CHECK: {{^}}}
-define void @test39(ptr %p) {
+define void @test39(ptr %p, i1 %arg) {
 entry:
   %0 = call ptr @llvm.objc.retain(ptr %p)
   br label %loop
 
 loop:                                             ; preds = %loop, %entry
-  br i1 undef, label %loop, label %exit
+  br i1 %arg, label %loop, label %exit
 
 exit:                                             ; preds = %loop
   call void @llvm.objc.release(ptr %0), !clang.imprecise_release !0
@@ -1779,14 +1779,14 @@ exit:                                             ; preds = %loop
 ; CHECK-LABEL: define void @test39b(
 ; CHECK-NOT: @llvm.objc.
 ; CHECK: {{^}}}
-define void @test39b(ptr %p) {
+define void @test39b(ptr %p, i1 %arg) {
 entry:
   %0 = call ptr @llvm.objc.retain(ptr %p)
   br label %loop
 
 loop:                                             ; preds = %loop, %entry
   store i8 0, ptr %0
-  br i1 undef, label %loop, label %exit
+  br i1 %arg, label %loop, label %exit
 
 exit:                                             ; preds = %loop
   call void @llvm.objc.release(ptr %0), !clang.imprecise_release !0
@@ -1798,14 +1798,14 @@ exit:                                             ; preds = %loop
 ; CHECK-LABEL: define void @test39c(
 ; CHECK-NOT: @llvm.objc.
 ; CHECK: {{^}}}
-define void @test39c(ptr %p) {
+define void @test39c(ptr %p, i1 %arg) {
 entry:
   %0 = call ptr @llvm.objc.retain(ptr %p)
   br label %loop
 
 loop:                                             ; preds = %loop, %entry
   call void @use_pointer(ptr %0)
-  br i1 undef, label %loop, label %exit
+  br i1 %arg, label %loop, label %exit
 
 exit:                                             ; preds = %loop
   call void @llvm.objc.release(ptr %0), !clang.imprecise_release !0
@@ -1818,14 +1818,14 @@ exit:                                             ; preds = %loop
 ; CHECK-LABEL: define void @test40(
 ; CHECK-NOT: @llvm.objc.
 ; CHECK: {{^}}}
-define void @test40(ptr %p) {
+define void @test40(ptr %p, i1 %arg) {
 entry:
   %0 = call ptr @llvm.objc.retain(ptr %p)
   br label %loop
 
 loop:                                             ; preds = %loop, %entry
   call void @use_pointer(ptr %0)
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:                                             ; preds = %loop
   call void @llvm.objc.release(ptr %0), !clang.imprecise_release !0
diff --git a/llvm/test/Transforms/ObjCARC/cfg-hazards.ll b/llvm/test/Transforms/ObjCARC/cfg-hazards.ll
index 3e762de689d1f4..d43f713d925e09 100644
--- a/llvm/test/Transforms/ObjCARC/cfg-hazards.ll
+++ b/llvm/test/Transforms/ObjCARC/cfg-hazards.ll
@@ -111,7 +111,7 @@ for.end:                                          ; preds = %for.body
 }
 
 ; Delete nested retain+release pairs around loops.
-define void @test3(ptr %a) nounwind {
+define void @test3(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test3(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
@@ -119,7 +119,7 @@ define void @test3(ptr %a) nounwind {
 ; CHECK:       loop:
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    store i8 0, ptr [[A]], align 1
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[EXIT:%.*]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
 ; CHECK-NEXT:    ret void
@@ -132,7 +132,7 @@ entry:
 loop:
   call void @callee()
   store i8 0, ptr %a
-  br i1 undef, label %loop, label %exit
+  br i1 %arg, label %loop, label %exit
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -140,7 +140,7 @@ exit:
   ret void
 }
 
-define void @test4(ptr %a) nounwind {
+define void @test4(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test4(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
@@ -151,7 +151,7 @@ define void @test4(ptr %a) nounwind {
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    store i8 0, ptr [[A]], align 1
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[EXIT:%.*]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
 ; CHECK-NEXT:    ret void
@@ -168,7 +168,7 @@ more:
   call void @callee()
   call void @callee()
   store i8 0, ptr %a
-  br i1 undef, label %loop, label %exit
+  br i1 %arg, label %loop, label %exit
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -176,18 +176,18 @@ exit:
   ret void
 }
 
-define void @test5(ptr %a) nounwind {
+define void @test5(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test5(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @use_pointer(ptr [[A]])
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
@@ -200,13 +200,13 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @use_pointer(ptr %a)
@@ -215,18 +215,18 @@ exit:
   ret void
 }
 
-define void @test6(ptr %a) nounwind {
+define void @test6(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test6(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @use_pointer(ptr [[A]])
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
@@ -238,14 +238,14 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   call void @callee()
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @use_pointer(ptr %a)
@@ -254,19 +254,19 @@ exit:
   ret void
 }
 
-define void @test7(ptr %a) nounwind {
+define void @test7(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test7(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    call void @use_pointer(ptr [[A]])
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
 ; CHECK-NEXT:    ret void
@@ -278,14 +278,14 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   call void @use_pointer(ptr %a)
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -293,19 +293,19 @@ exit:
   ret void
 }
 
-define void @test8(ptr %a) nounwind {
+define void @test8(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test8(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    call void @use_pointer(ptr [[A]])
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
 ; CHECK-NEXT:    ret void
@@ -316,7 +316,7 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   call void @callee()
@@ -324,7 +324,7 @@ true:
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -332,17 +332,17 @@ exit:
   ret void
 }
 
-define void @test9(ptr %a) nounwind {
+define void @test9(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test9(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    call void @use_pointer(ptr [[A:%.*]])
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret void
 ;
@@ -352,14 +352,14 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   call void @use_pointer(ptr %a)
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -367,17 +367,17 @@ exit:
   ret void
 }
 
-define void @test10(ptr %a) nounwind {
+define void @test10(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test10(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    call void @callee()
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret void
 ;
@@ -387,14 +387,14 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   call void @callee()
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -402,16 +402,16 @@ exit:
   ret void
 }
 
-define void @test11(ptr %a) nounwind {
+define void @test11(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test11(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    br label [[MORE]]
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret void
 ;
@@ -421,13 +421,13 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   br label %more
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -437,18 +437,18 @@ exit:
 
 ; Don't delete anything if they're not balanced.
 
-define void @test12(ptr %a) nounwind {
+define void @test12(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test12(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[OUTER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A:%.*]]) #[[ATTR0]]
 ; CHECK-NEXT:    [[INNER:%.*]] = tail call ptr @llvm.objc.retain(ptr [[A]]) #[[ATTR0]]
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    br i1 undef, label [[TRUE:%.*]], label [[MORE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[TRUE:%.*]], label [[MORE:%.*]]
 ; CHECK:       true:
 ; CHECK-NEXT:    ret void
 ; CHECK:       more:
-; CHECK-NEXT:    br i1 undef, label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    br i1 %arg, label [[EXIT:%.*]], label [[LOOP]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]]
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
@@ -460,13 +460,13 @@ entry:
   br label %loop
 
 loop:
-  br i1 undef, label %true, label %more
+  br i1 %arg, label %true, label %more
 
 true:
   ret void
 
 more:
-  br i1 undef, label %exit, label %loop
+  br i1 %arg, label %exit, label %loop
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind
@@ -479,7 +479,7 @@ exit:
 ; by an alloca.
 ; rdar://12969722
 
-define void @test13(ptr %a) nounwind {
+define void @test13(ptr %a, i1 %arg) nounwind {
 ; CHECK-LABEL: @test13(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[BLOCK:%.*]] = alloca ptr, align 8
@@ -491,7 +491,7 @@ define void @test13(ptr %a) nounwind {
 ; CHECK-NEXT:    call void @block_callee(ptr [[BLOCK]])
 ; CHECK-NEXT:    [[RELOADED_A:%.*]] = load ptr, ptr [[BLOCK]], align 8
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[RELOADED_A]]) #[[ATTR0]], !clang.imprecise_release !0
-; CHECK-NEXT:    br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LOOP]], label [[EXIT:%.*]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    call void @llvm.objc.release(ptr [[A]]) #[[ATTR0]], !clang.imprecise_release !0
 ; CHECK-NEXT:    ret void
@@ -507,7 +507,7 @@ loop:
   call void @block_callee(ptr %block)
   %reloaded_a = load ptr, ptr %block, align 8
   call void @llvm.objc.release(ptr %reloaded_a) nounwind, !clang.imprecise_release !0
-  br i1 undef, label %loop, label %exit
+  br i1 %arg, label %loop, label %exit
 
 exit:
   call void @llvm.objc.release(ptr %a) nounwind, !clang.imprecise_release !0
diff --git a/llvm/test/Transforms/ObjCARC/contract-testcases.ll b/llvm/test/Transforms/ObjCARC/contract-testcases.ll
index 36fe49382e4136..4c842823b54e07 100644
--- a/llvm/test/Transforms/ObjCARC/contract-testcases.ll
+++ b/llvm/test/Transforms/ObjCARC/contract-testcases.ll
@@ -19,13 +19,13 @@ declare i32 @__gxx_personality_sj0(...)
 ; Don't get in trouble on bugpointed code.
 
 ; CHECK-LABEL: define void @test0(
-define void @test0() {
+define void @test0(i1 %arg) {
 bb:
   %tmp1 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr undef) nounwind
   br label %bb3
 
 bb3:                                              ; preds = %bb2
-  br i1 undef, label %bb6, label %bb4
+  br i1 %arg, label %bb6, label %bb4
 
 bb4:                                              ; preds = %bb3
   switch i64 undef, label %bb5 [
@@ -45,15 +45,15 @@ bb6:                                              ; preds = %bb5, %bb4, %bb4, %b
 ; for the same block, use the exactly same value in each block.
 
 ; CHECK-LABEL: define void @test1(
-; CHECK: br i1 undef, label %bb7, label %bb7
+; CHECK: br i1 %arg, label %bb7, label %bb7
 ; CHECK: bb7:
 ; CHECK: %tmp8 = phi ptr [ %tmp3, %bb ], [ %tmp3, %bb ]
 ; CHECK: }
-define void @test1() {
+define void @test1(i1 %arg) {
 bb:
   %tmp = tail call ptr @objc_msgSend()
   %tmp3 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %tmp) nounwind
-  br i1 undef, label %bb7, label %bb7
+  br i1 %arg, label %bb7, label %bb7
 
 bb7:                                              ; preds = %bb6, %bb6, %bb5
   %tmp8 = phi ptr [ %tmp, %bb ], [ %tmp, %bb ]
diff --git a/llvm/test/Transforms/ObjCARC/empty-block.ll b/llvm/test/Transforms/ObjCARC/empty-block.ll
index 80930812fc7e97..be70beeeb731da 100644
--- a/llvm/test/Transforms/ObjCARC/empty-block.ll
+++ b/llvm/test/Transforms/ObjCARC/empty-block.ll
@@ -18,9 +18,9 @@ declare ptr @llvm.objc.autoreleaseReturnValue(ptr)
 ; CHECK: @llvm.objc.autoreleaseReturnValue
 ; CHECK-NOT: @llvm.objc.
 ; CHECK: }
-define ptr @test0(ptr %buffer) nounwind {
+define ptr @test0(ptr %buffer, i1 %arg) nounwind {
   %1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
-  br i1 undef, label %.lr.ph, label %._crit_edge
+  br i1 %arg, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %.lr.ph, %0
   br i1 false, label %.lr.ph, label %._crit_edge
@@ -37,10 +37,10 @@ define ptr @test0(ptr %buffer) nounwind {
 ; CHECK-LABEL: define ptr @test1(
 ; CHECK-NOT: @objc
 ; CHECK: }
-define ptr @test1() nounwind {
+define ptr @test1(i1 %arg) nounwind {
   %buffer = call ptr @foo()
   %1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
-  br i1 undef, label %.lr.ph, label %._crit_edge
+  br i1 %arg, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %.lr.ph, %0
   br i1 false, label %.lr.ph, label %._crit_edge
diff --git a/llvm/test/Transforms/ObjCARC/path-overflow.ll b/llvm/test/Transforms/ObjCARC/path-overflow.ll
index eeef70554d1148..431b3774812629 100644
--- a/llvm/test/Transforms/ObjCARC/path-overflow.ll
+++ b/llvm/test/Transforms/ObjCARC/path-overflow.ll
@@ -29,9 +29,9 @@ declare i32 @__gxx_personality_sj0(...)
 declare i32 @__objc_personality_v0(...)
 
 
-define hidden void @test1() personality ptr @__gxx_personality_sj0 {
+define hidden void @test1(i1 %arg) personality ptr @__gxx_personality_sj0 {
 entry:
-  br i1 undef, label %msgSend.nullinit, label %msgSend.call
+  br i1 %arg, label %msgSend.nullinit, label %msgSend.call
 
 msgSend.call:                                     ; preds = %entry
   br label %msgSend.cont
@@ -41,7 +41,7 @@ msgSend.nullinit:                                 ; preds = %entry
 
 msgSend.cont:                                     ; preds = %msgSend.nullinit, %msgSend.call
   %0 = call ptr @llvm.objc.retain(ptr @_unnamed_cfstring) nounwind
-  br i1 undef, label %msgSend.nullinit33, label %msgSend.call32
+  br i1 %arg, label %msgSend.nullinit33, label %msgSend.call32
 
 msgSend.call32:                                   ; preds = %if.end10
   br label %msgSend.cont34
@@ -50,7 +50,7 @@ msgSend.nullinit33:                               ; preds = %if.end10
   br label %msgSend.cont34
 
 msgSend.cont34:                                   ; preds = %msgSend.nullinit33, %msgSend.call32
-  br i1 undef, label %msgSend.nullinit38, label %msgSend.call37
+  br i1 %arg, label %msgSend.nullinit38, label %msgSend.call37
 
 msgSend.call37:                                   ; preds = %msgSend.cont34
   br label %msgSend.cont39
@@ -59,7 +59,7 @@ msgSend.nullinit38:                               ; preds = %msgSend.cont34
   br label %msgSend.cont39
 
 msgSend.cont39:                                   ; preds = %msgSend.nullinit38, %msgSend.call37
-  br i1 undef, label %msgSend.nullinit49, label %msgSend.call48
+  br i1 %arg, label %msgSend.nullinit49, label %msgSend.call48
 
 msgSend.call48:                                   ; preds = %msgSend.cont39
   br label %msgSend.cont50
@@ -68,7 +68,7 @@ msgSend.nullinit49:                               ; preds = %msgSend.cont39
   br label %msgSend.cont50
 
 msgSend.cont50:                                   ; preds = %msgSend.nullinit49, %msgSend.call48
-  br i1 undef, label %msgSend.nullinit61, label %msgSend.call60
+  br i1 %arg, label %msgSend.nullinit61, label %msgSend.call60
 
 msgSend.call60:                                   ; preds = %msgSend.cont50
   br label %msgSend.cont62
@@ -77,7 +77,7 @@ msgSend.nullinit61:                               ; preds = %msgSend.cont50
   br label %msgSend.cont62
 
 msgSend.cont62:                                   ; preds = %msgSend.nullinit61, %msgSend.call60
-  br i1 undef, label %msgSend.nullinit67, label %msgSend.call66
+  br i1 %arg, label %msgSend.nullinit67, label %msgSend.call66
 
 msgSend.call66:                                   ; preds = %msgSend.cont62
   br label %msgSend.cont68
@@ -86,7 +86,7 @@ msgSend.nullinit67:                               ; preds = %msgSend.cont62
   br label %msgSend.cont68
 
 msgSend.cont68:                                   ; preds = %msgSend.nullinit67, %msgSend.call66
-  br i1 undef, label %msgSend.nullinit84, label %msgSend.call83
+  br i1 %arg, label %msgSend.nullinit84, label %msgSend.call83
 
 msgSend.call83:                                   ; preds = %msgSend.cont68
   br label %msgSend.cont85
@@ -95,7 +95,7 @@ msgSend.nullinit84:                               ; preds = %msgSend.cont68
   br label %msgSend.cont85
 
 msgSend.cont85:                                   ; preds = %msgSend.nullinit84, %msgSend.call83
-  br i1 undef, label %msgSend.nullinit90, label %msgSend.call89
+  br i1 %arg, label %msgSend.nullinit90, label %msgSend.call89
 
 msgSend.call89:                                   ; preds = %msgSend.cont85
   br label %msgSend.cont91
@@ -104,7 +104,7 @@ msgSend.nullinit90:                               ; preds = %msgSend.cont85
   br label %msgSend.cont91
 
 msgSend.cont91:                                   ; preds = %msgSend.nullinit90, %msgSend.call89
-  br i1 undef, label %msgSend.nullinit104, label %msgSend.call103
+  br i1 %arg, label %msgSend.nullinit104, label %msgSend.call103
 
 msgSend.call103:                                  ; preds = %msgSend.cont91
   br label %msgSend.cont105
@@ -113,16 +113,16 @@ msgSend.nullinit104:                              ; preds = %msgSend.cont91
   br label %msgSend.cont105
 
 msgSend.cont105:                                  ; preds = %msgSend.nullinit104, %msgSend.call103
-  br i1 undef, label %land.lhs.true, label %if.end123
+  br i1 %arg, label %land.lhs.true, label %if.end123
 
 land.lhs.true:                                    ; preds = %msgSend.cont105
-  br i1 undef, label %if.then117, label %if.end123
+  br i1 %arg, label %if.then117, label %if.end123
 
 if.then117:                                       ; preds = %land.lhs.true
   br label %if.end123
 
 if.end123:                                        ; preds = %if.then117, %land.lhs.true, %msgSend.cont105
-  br i1 undef, label %msgSend.nullinit132, label %msgSend.call131
+  br i1 %arg, label %msgSend.nullinit132, label %msgSend.call131
 
 msgSend.call131:                                  ; preds = %if.end123
   br label %msgSend.cont133
@@ -131,7 +131,7 @@ msgSend.nullinit132:                              ; preds = %if.end123
   br label %msgSend.cont133
 
 msgSend.cont133:                                  ; preds = %msgSend.nullinit132, %msgSend.call131
-  br i1 undef, label %msgSend.nullinit139, label %msgSend.call138
+  br i1 %arg, label %msgSend.nullinit139, label %msgSend.call138
 
 msgSend.call138:                                  ; preds = %msgSend.cont133
   br label %msgSend.cont140
@@ -140,13 +140,13 @@ msgSend.nullinit139:                              ; preds = %msgSend.cont133
   br label %msgSend.cont140
 
 msgSend.cont140:                                  ; preds = %msgSend.nullinit139, %msgSend.call138
-  br i1 undef, label %if.then151, label %if.end157
+  br i1 %arg, label %if.then151, label %if.end157
 
 if.then151:                                       ; preds = %msgSend.cont140
   br label %if.end157
 
 if.end157:                                        ; preds = %if.then151, %msgSend.cont140
-  br i1 undef, label %msgSend.nullinit164, label %msgSend.call163
+  br i1 %arg, label %msgSend.nullinit164, label %msgSend.call163
 
 msgSend.call163:                                  ; preds = %if.end157
   br label %msgSend.cont165
@@ -155,7 +155,7 @@ msgSend.nullinit164:                              ; preds = %if.end157
   br label %msgSend.cont165
 
 msgSend.cont165:                                  ; preds = %msgSend.nullinit164, %msgSend.call163
-  br i1 undef, label %msgSend.nullinit176, label %msgSend.call175
+  br i1 %arg, label %msgSend.nullinit176, label %msgSend.call175
 
 msgSend.call175:                                  ; preds = %msgSend.cont165
   br label %msgSend.cont177
@@ -164,13 +164,13 @@ msgSend.nullinit176:                              ; preds = %msgSend.cont165
   br label %msgSend.cont177
 
 msgSend.cont177:                                  ; preds = %msgSend.nullinit176, %msgSend.call175
-  br i1 undef, label %land.lhs.true181, label %if.end202
+  br i1 %arg, label %land.lhs.true181, label %if.end202
 
 land.lhs.true181:                                 ; preds = %msgSend.cont177
-  br i1 undef, label %if.then187, label %if.end202
+  br i1 %arg, label %if.then187, label %if.end202
 
 if.then187:                                       ; preds = %land.lhs.true181
-  br i1 undef, label %msgSend.nullinit199, label %msgSend.call198
+  br i1 %arg, label %msgSend.nullinit199, label %msgSend.call198
 
 msgSend.call198:                                  ; preds = %if.then187
   br label %msgSend.cont200
@@ -182,7 +182,7 @@ msgSend.cont200:                                  ; preds = %msgSend.nullinit199
   br label %if.end202
 
 if.end202:                                        ; preds = %msgSend.cont200, %land.lhs.true181, %msgSend.cont177
-  br i1 undef, label %msgSend.nullinit236, label %msgSend.call235
+  br i1 %arg, label %msgSend.nullinit236, label %msgSend.call235
 
 msgSend.call235:                                  ; preds = %if.end202
   br label %msgSend.cont237
@@ -191,7 +191,7 @@ msgSend.nullinit236:                              ; preds = %if.end202
   br label %msgSend.cont237
 
 msgSend.cont237:                                  ; preds = %msgSend.nullinit236, %msgSend.call235
-  br i1 undef, label %msgSend.nullinit254, label %msgSend.call253
+  br i1 %arg, label %msgSend.nullinit254, label %msgSend.call253
 
 msgSend.call253:                                  ; preds = %msgSend.cont237
   br label %msgSend.cont255
@@ -200,7 +200,7 @@ msgSend.nullinit254:                              ; preds = %msgSend.cont237
   br label %msgSend.cont255
 
 msgSend.cont255:                                  ; preds = %msgSend.nullinit254, %msgSend.call253
-  br i1 undef, label %msgSend.nullinit269, label %msgSend.call268
+  br i1 %arg, label %msgSend.nullinit269, label %msgSend.call268
 
 msgSend.call268:                                  ; preds = %msgSend.cont255
   br label %msgSend.cont270
@@ -209,7 +209,7 @@ msgSend.nullinit269:                              ; preds = %msgSend.cont255
   br label %msgSend.cont270
 
 msgSend.cont270:                                  ; preds = %msgSend.nullinit269, %msgSend.call268
-  br i1 undef, label %msgSend.nullinit281, label %msgSend.call280
+  br i1 %arg, label %msgSend.nullinit281, label %msgSend.call280
 
 msgSend.call280:                                  ; preds = %msgSend.cont270
   br label %msgSend.cont282
@@ -218,7 +218,7 @@ msgSend.nullinit281:                              ; preds = %msgSend.cont270
   br label %msgSend.cont282
 
 msgSend.cont282:                                  ; preds = %msgSend.nullinit281, %msgSend.call280
-  br i1 undef, label %msgSend.nullinit287, label %msgSend.call286
+  br i1 %arg, label %msgSend.nullinit287, label %msgSend.call286
 
 msgSend.call286:                                  ; preds = %msgSend.cont282
   br label %msgSend.cont288
@@ -227,7 +227,7 @@ msgSend.nullinit287:                              ; preds = %msgSend.cont282
   br label %msgSend.cont288
 
 msgSend.cont288:                                  ; preds = %msgSend.nullinit287, %msgSend.call286
-  br i1 undef, label %msgSend.nullinit303, label %msgSend.call302
+  br i1 %arg, label %msgSend.nullinit303, label %msgSend.call302
 
 msgSend.call302:                                  ; preds = %msgSend.cont288
   br label %msgSend.cont304
@@ -236,7 +236,7 @@ msgSend.nullinit303:                              ; preds = %msgSend.cont288
   br label %msgSend.cont304
 
 msgSend.cont304:                                  ; preds = %msgSend.nullinit303, %msgSend.call302
-  br i1 undef, label %msgSend.nullinit344, label %msgSend.call343
+  br i1 %arg, label %msgSend.nullinit344, label %msgSend.call343
 
 msgSend.call343:                                  ; preds = %msgSend.cont304
   br label %msgSend.cont345
@@ -245,7 +245,7 @@ msgSend.nullinit344:                              ; preds = %msgSend.cont304
   br label %msgSend.cont345
 
 msgSend.cont345:                                  ; preds = %msgSend.nullinit344, %msgSend.call343
-  br i1 undef, label %msgSend.nullinit350, label %msgSend.call349
+  br i1 %arg, label %msgSend.nullinit350, label %msgSend.call349
 
 msgSend.call349:                                  ; preds = %msgSend.cont345
   br label %msgSend.cont351
@@ -254,7 +254,7 @@ msgSend.nullinit350:                              ; preds = %msgSend.cont345
   br label %msgSend.cont351
 
 msgSend.cont351:                                  ; preds = %msgSend.nullinit350, %msgSend.call349
-  br i1 undef, label %msgSend.nullinit366, label %msgSend.call365
+  br i1 %arg, label %msgSend.nullinit366, label %msgSend.call365
 
 msgSend.call365:                                  ; preds = %msgSend.cont351
   br label %msgSend.cont367
@@ -263,7 +263,7 @@ msgSend.nullinit366:                              ; preds = %msgSend.cont351
   br label %msgSend.cont367
 
 msgSend.cont367:                                  ; preds = %msgSend.nullinit366, %msgSend.call365
-  br i1 undef, label %msgSend.nullinit376, label %msgSend.call375
+  br i1 %arg, label %msgSend.nullinit376, label %msgSend.call375
 
 msgSend.call375:                                  ; preds = %msgSend.cont367
   br label %msgSend.cont377
@@ -272,10 +272,10 @@ msgSend.nullinit376:                              ; preds = %msgSend.cont367
   br label %msgSend.cont377
 
 msgSend.cont377:                                  ; preds = %msgSend.nullinit376, %msgSend.call375
-  br i1 undef, label %if.then384, label %if.else401
+  br i1 %arg, label %if.then384, label %if.else401
 
 if.then384:                                       ; preds = %msgSend.cont377
-  br i1 undef, label %msgSend.nullinit392, label %msgSend.call391
+  br i1 %arg, label %msgSend.nullinit392, label %msgSend.call391
 
 msgSend.call391:                                  ; preds = %if.then384
   br label %msgSend.cont393
@@ -287,7 +287,7 @@ msgSend.cont393:                                  ; preds = %msgSend.nullinit392
   br label %if.end418
 
 if.else401:                                       ; preds = %msgSend.cont377
-  br i1 undef, label %msgSend.nullinit409, label %msgSend.call408
+  br i1 %arg, label %msgSend.nullinit409, label %msgSend.call408
 
 msgSend.call408:                                  ; preds = %if.else401
   br label %msgSend.cont410
@@ -299,7 +299,7 @@ msgSend.cont410:                                  ; preds = %msgSend.nullinit409
   br label %if.end418
 
 if.end418:                                        ; preds = %msgSend.cont410, %msgSend.cont393
-  br i1 undef, label %msgSend.nullinit470, label %msgSend.call469
+  br i1 %arg, label %msgSend.nullinit470, label %msgSend.call469
 
 msgSend.call469:                                  ; preds = %if.end418
   br label %msgSend.cont471
@@ -308,7 +308,7 @@ msgSend.nullinit470:                              ; preds = %if.end418
   br label %msgSend.cont471
 
 msgSend.cont471:                                  ; preds = %msgSend.nullinit470, %msgSend.call469
-  br i1 undef, label %msgSend.nullinit484, label %msgSend.call483
+  br i1 %arg, label %msgSend.nullinit484, label %msgSend.call483
 
 msgSend.call483:                                  ; preds = %msgSend.cont471
   br label %msgSend.cont485
@@ -317,7 +317,7 @@ msgSend.nullinit484:                              ; preds = %msgSend.cont471
   br label %msgSend.cont485
 
 msgSend.cont485:                                  ; preds = %msgSend.nullinit484, %msgSend.call483
-  br i1 undef, label %msgSend.nullinit500, label %msgSend.call499
+  br i1 %arg, label %msgSend.nullinit500, label %msgSend.call499
 
 msgSend.call499:                                  ; preds = %msgSend.cont485
   br label %msgSend.cont501
@@ -326,7 +326,7 @@ msgSend.nullinit500:                              ; preds = %msgSend.cont485
   br label %msgSend.cont501
 
 msgSend.cont501:                                  ; preds = %msgSend.nullinit500, %msgSend.call499
-  br i1 undef, label %msgSend.nullinit506, label %msgSend.call505
+  br i1 %arg, label %msgSend.nullinit506, label %msgSend.call505
 
 msgSend.call505:                                  ; preds = %msgSend.cont501
   br label %msgSend.cont507
@@ -340,78 +340,78 @@ msgSend.cont507:                                  ; preds = %msgSend.nullinit506
 }
 
 ; Function Attrs: optsize ssp uwtable
-define void @test2() unnamed_addr align 2 personality ptr @__gxx_personality_sj0 {
+define void @test2(i1 %arg) unnamed_addr align 2 personality ptr @__gxx_personality_sj0 {
 bb:
-  br i1 undef, label %bb3, label %bb2
+  br i1 %arg, label %bb3, label %bb2
 
 bb2:                                              ; preds = %bb
   br label %bb3
 
 bb3:                                              ; preds = %bb2, %bb
-  br i1 undef, label %bb5, label %bb4
+  br i1 %arg, label %bb5, label %bb4
 
 bb4:                                              ; preds = %bb3
   br label %bb5
 
 bb5:                                              ; preds = %bb4, %bb3
-  br i1 undef, label %bb7, label %bb6
+  br i1 %arg, label %bb7, label %bb6
 
 bb6:                                              ; preds = %bb5
   br label %bb7
 
 bb7:                                              ; preds = %bb6, %bb5
-  br i1 undef, label %bb9, label %bb8
+  br i1 %arg, label %bb9, label %bb8
 
 bb8:                                              ; preds = %bb7
   unreachable
 
 bb9:                                              ; preds = %bb7
-  br i1 undef, label %bb11, label %bb10
+  br i1 %arg, label %bb11, label %bb10
 
 bb10:                                             ; preds = %bb9
   br label %bb11
 
 bb11:                                             ; preds = %bb10, %bb9
-  br i1 undef, label %bb13, label %bb12
+  br i1 %arg, label %bb13, label %bb12
 
 bb12:                                             ; preds = %bb11
   br label %bb13
 
 bb13:                                             ; preds = %bb12, %bb11
-  br i1 undef, label %bb15, label %bb14
+  br i1 %arg, label %bb15, label %bb14
 
 bb14:                                             ; preds = %bb13
   br label %bb15
 
 bb15:                                             ; preds = %bb14, %bb13
-  br i1 undef, label %bb17, label %bb16
+  br i1 %arg, label %bb17, label %bb16
 
 bb16:                                             ; preds = %bb15
   br label %bb17
 
 bb17:                                             ; preds = %bb16, %bb15
-  br i1 undef, label %bb19, label %bb18
+  br i1 %arg, label %bb19, label %bb18
 
 bb18:                                             ; preds = %bb17
   br label %bb19
 
 bb19:                                             ; preds = %bb18, %bb17
-  br i1 undef, label %bb222, label %bb20
+  br i1 %arg, label %bb222, label %bb20
 
 bb20:                                             ; preds = %bb19
-  br i1 undef, label %bb222, label %bb21
+  br i1 %arg, label %bb222, label %bb21
 
 bb21:                                             ; preds = %bb20
-  br i1 undef, label %bb22, label %bb30
+  br i1 %arg, label %bb22, label %bb30
 
 bb22:                                             ; preds = %bb21
-  br i1 undef, label %bb23, label %bb32
+  br i1 %arg, label %bb23, label %bb32
 
 bb23:                                             ; preds = %bb22
-  br i1 undef, label %bb24, label %bb34
+  br i1 %arg, label %bb24, label %bb34
 
 bb24:                                             ; preds = %bb23
-  br i1 undef, label %bb26, label %bb25
+  br i1 %arg, label %bb26, label %bb25
 
 bb25:                                             ; preds = %bb24
   br label %bb27
@@ -420,10 +420,10 @@ bb26:                                             ; preds = %bb24
   br label %bb27
 
 bb27:                                             ; preds = %bb26, %bb25
-  br i1 undef, label %bb28, label %bb42
+  br i1 %arg, label %bb28, label %bb42
 
 bb28:                                             ; preds = %bb27
-  br i1 undef, label %bb36, label %bb29
+  br i1 %arg, label %bb36, label %bb29
 
 bb29:                                             ; preds = %bb28
   br label %bb36
@@ -438,7 +438,7 @@ bb34:                                             ; preds = %bb23
   unreachable
 
 bb36:                                             ; preds = %bb29, %bb28
-  br i1 undef, label %bb38, label %bb37
+  br i1 %arg, label %bb38, label %bb37
 
 bb37:                                             ; preds = %bb36
   br label %bb39
@@ -447,7 +447,7 @@ bb38:                                             ; preds = %bb36
   br label %bb39
 
 bb39:                                             ; preds = %bb38, %bb37
-  br i1 undef, label %bb41, label %bb40
+  br i1 %arg, label %bb41, label %bb40
 
 bb40:                                             ; preds = %bb39
   unreachable
@@ -456,19 +456,19 @@ bb41:                                             ; preds = %bb39
   br label %bb42
 
 bb42:                                             ; preds = %bb41, %bb27
-  br i1 undef, label %bb43, label %bb214
+  br i1 %arg, label %bb43, label %bb214
 
 bb43:                                             ; preds = %bb42
-  br i1 undef, label %bb47, label %bb45
+  br i1 %arg, label %bb47, label %bb45
 
 bb45:                                             ; preds = %bb130, %bb128, %bb126, %bb124, %bb122, %bb120, %bb118, %bb116, %bb114, %bb112, %bb110, %bb108, %bb105, %bb102, %bb100, %bb96, %bb94, %bb90, %bb88, %bb84, %bb82, %bb78, %bb76, %bb72, %bb70, %bb66, %bb64, %bb60, %bb58, %bb54, %bb51, %bb43
   unreachable
 
 bb47:                                             ; preds = %bb43
-  br i1 undef, label %bb48, label %bb106
+  br i1 %arg, label %bb48, label %bb106
 
 bb48:                                             ; preds = %bb47
-  br i1 undef, label %bb50, label %bb49
+  br i1 %arg, label %bb50, label %bb49
 
 bb49:                                             ; preds = %bb48
   br label %bb51
@@ -477,16 +477,16 @@ bb50:                                             ; preds = %bb48
   br label %bb51
 
 bb51:                                             ; preds = %bb50, %bb49
-  br i1 undef, label %bb53, label %bb45
+  br i1 %arg, label %bb53, label %bb45
 
 bb53:                                             ; preds = %bb51
-  br i1 undef, label %bb54, label %bb134
+  br i1 %arg, label %bb54, label %bb134
 
 bb54:                                             ; preds = %bb53
-  br i1 undef, label %bb55, label %bb45
+  br i1 %arg, label %bb55, label %bb45
 
 bb55:                                             ; preds = %bb54
-  br i1 undef, label %bb57, label %bb56
+  br i1 %arg, label %bb57, label %bb56
 
 bb56:                                             ; preds = %bb55
   br label %bb58
@@ -495,13 +495,13 @@ bb57:                                             ; preds = %bb55
   br label %bb58
 
 bb58:                                             ; preds = %bb57, %bb56
-  br i1 undef, label %bb60, label %bb45
+  br i1 %arg, label %bb60, label %bb45
 
 bb60:                                             ; preds = %bb58
-  br i1 undef, label %bb61, label %bb45
+  br i1 %arg, label %bb61, label %bb45
 
 bb61:                                             ; preds = %bb60
-  br i1 undef, label %bb63, label %bb62
+  br i1 %arg, label %bb63, label %bb62
 
 bb62:                                             ; preds = %bb61
   br label %bb64
@@ -510,13 +510,13 @@ bb63:                                             ; preds = %bb61
   br label %bb64
 
 bb64:                                             ; preds = %bb63, %bb62
-  br i1 undef, label %bb66, label %bb45
+  br i1 %arg, label %bb66, label %bb45
 
 bb66:                                             ; preds = %bb64
-  br i1 undef, label %bb67, label %bb45
+  br i1 %arg, label %bb67, label %bb45
 
 bb67:                                             ; preds = %bb66
-  br i1 undef, label %bb69, label %bb68
+  br i1 %arg, label %bb69, label %bb68
 
 bb68:                                             ; preds = %bb67
   br label %bb70
@@ -525,13 +525,13 @@ bb69:                                             ; preds = %bb67
   br label %bb70
 
 bb70:                                             ; preds = %bb69, %bb68
-  br i1 undef, label %bb72, label %bb45
+  br i1 %arg, label %bb72, label %bb45
 
 bb72:                                             ; preds = %bb70
-  br i1 undef, label %bb73, label %bb45
+  br i1 %arg, label %bb73, label %bb45
 
 bb73:                                             ; preds = %bb72
-  br i1 undef, label %bb75, label %bb74
+  br i1 %arg, label %bb75, label %bb74
 
 bb74:                                             ; preds = %bb73
   br label %bb76
@@ -540,13 +540,13 @@ bb75:                                             ; preds = %bb73
   br label %bb76
 
 bb76:                                             ; preds = %bb75, %bb74
-  br i1 undef, label %bb78, label %bb45
+  br i1 %arg, label %bb78, label %bb45
 
 bb78:                                             ; preds = %bb76
-  br i1 undef, label %bb79, label %bb45
+  br i1 %arg, label %bb79, label %bb45
 
 bb79:                                             ; preds = %bb78
-  br i1 undef, label %bb81, label %bb80
+  br i1 %arg, label %bb81, label %bb80
 
 bb80:                                             ; preds = %bb79
   br label %bb82
@@ -555,13 +555,13 @@ bb81:                                             ; preds = %bb79
   br label %bb82
 
 bb82:                                             ; preds = %bb81, %bb80
-  br i1 undef, label %bb84, label %bb45
+  br i1 %arg, label %bb84, label %bb45
 
 bb84:                                             ; preds = %bb82
-  br i1 undef, label %bb85, label %bb45
+  br i1 %arg, label %bb85, label %bb45
 
 bb85:                                             ; preds = %bb84
-  br i1 undef, label %bb87, label %bb86
+  br i1 %arg, label %bb87, label %bb86
 
 bb86:                                             ; preds = %bb85
   br label %bb88
@@ -570,13 +570,13 @@ bb87:                                             ; preds = %bb85
   br label %bb88
 
 bb88:                                             ; preds = %bb87, %bb86
-  br i1 undef, label %bb90, label %bb45
+  br i1 %arg, label %bb90, label %bb45
 
 bb90:                                             ; preds = %bb88
-  br i1 undef, label %bb91, label %bb45
+  br i1 %arg, label %bb91, label %bb45
 
 bb91:                                             ; preds = %bb90
-  br i1 undef, label %bb93, label %bb92
+  br i1 %arg, label %bb93, label %bb92
 
 bb92:                                             ; preds = %bb91
   br label %bb94
@@ -585,13 +585,13 @@ bb93:                                             ; preds = %bb91
   br label %bb94
 
 bb94:                                             ; preds = %bb93, %bb92
-  br i1 undef, label %bb96, label %bb45
+  br i1 %arg, label %bb96, label %bb45
 
 bb96:                                             ; preds = %bb94
-  br i1 undef, label %bb97, label %bb45
+  br i1 %arg, label %bb97, label %bb45
 
 bb97:                                             ; preds = %bb96
-  br i1 undef, label %bb99, label %bb98
+  br i1 %arg, label %bb99, label %bb98
 
 bb98:                                             ; preds = %bb97
   br label %bb100
@@ -600,82 +600,82 @@ bb99:                                             ; preds = %bb97
   br label %bb100
 
 bb100:                                            ; preds = %bb99, %bb98
-  br i1 undef, label %bb102, label %bb45
+  br i1 %arg, label %bb102, label %bb45
 
 bb102:                                            ; preds = %bb100
-  br i1 undef, label %bb104, label %bb45
+  br i1 %arg, label %bb104, label %bb45
 
 bb104:                                            ; preds = %bb102
-  br i1 undef, label %bb108, label %bb105
+  br i1 %arg, label %bb108, label %bb105
 
 bb105:                                            ; preds = %bb104
-  br i1 undef, label %bb108, label %bb45
+  br i1 %arg, label %bb108, label %bb45
 
 bb106:                                            ; preds = %bb47
   unreachable
 
 bb108:                                            ; preds = %bb105, %bb104
-  br i1 undef, label %bb110, label %bb45
+  br i1 %arg, label %bb110, label %bb45
 
 bb110:                                            ; preds = %bb108
-  br i1 undef, label %bb112, label %bb45
+  br i1 %arg, label %bb112, label %bb45
 
 bb112:                                            ; preds = %bb110
-  br i1 undef, label %bb114, label %bb45
+  br i1 %arg, label %bb114, label %bb45
 
 bb114:                                            ; preds = %bb112
-  br i1 undef, label %bb116, label %bb45
+  br i1 %arg, label %bb116, label %bb45
 
 bb116:                                            ; preds = %bb114
-  br i1 undef, label %bb118, label %bb45
+  br i1 %arg, label %bb118, label %bb45
 
 bb118:                                            ; preds = %bb116
-  br i1 undef, label %bb120, label %bb45
+  br i1 %arg, label %bb120, label %bb45
 
 bb120:                                            ; preds = %bb118
-  br i1 undef, label %bb122, label %bb45
+  br i1 %arg, label %bb122, label %bb45
 
 bb122:                                            ; preds = %bb120
-  br i1 undef, label %bb124, label %bb45
+  br i1 %arg, label %bb124, label %bb45
 
 bb124:                                            ; preds = %bb122
-  br i1 undef, label %bb126, label %bb45
+  br i1 %arg, label %bb126, label %bb45
 
 bb126:                                            ; preds = %bb124
-  br i1 undef, label %bb128, label %bb45
+  br i1 %arg, label %bb128, label %bb45
 
 bb128:                                            ; preds = %bb126
-  br i1 undef, label %bb130, label %bb45
+  br i1 %arg, label %bb130, label %bb45
 
 bb130:                                            ; preds = %bb128
-  br i1 undef, label %bb132, label %bb45
+  br i1 %arg, label %bb132, label %bb45
 
 bb132:                                            ; preds = %bb130
-  br i1 undef, label %bb135, label %bb30
+  br i1 %arg, label %bb135, label %bb30
 
 bb134:                                            ; preds = %bb53
   unreachable
 
 bb135:                                            ; preds = %bb132
-  br i1 undef, label %bb139, label %bb136
+  br i1 %arg, label %bb139, label %bb136
 
 bb136:                                            ; preds = %bb135
-  br i1 undef, label %bb138, label %bb30
+  br i1 %arg, label %bb138, label %bb30
 
 bb138:                                            ; preds = %bb136
   br label %bb139
 
 bb139:                                            ; preds = %bb138, %bb135
-  br i1 undef, label %bb140, label %bb141
+  br i1 %arg, label %bb140, label %bb141
 
 bb140:                                            ; preds = %bb139
   unreachable
 
 bb141:                                            ; preds = %bb139
-  br i1 undef, label %bb142, label %bb215
+  br i1 %arg, label %bb142, label %bb215
 
 bb142:                                            ; preds = %bb141
-  br i1 undef, label %bb144, label %bb143
+  br i1 %arg, label %bb144, label %bb143
 
 bb143:                                            ; preds = %bb142
   br label %bb145
@@ -684,16 +684,16 @@ bb144:                                            ; preds = %bb142
   br label %bb145
 
 bb145:                                            ; preds = %bb144, %bb143
-  br i1 undef, label %bb146, label %bb151
+  br i1 %arg, label %bb146, label %bb151
 
 bb146:                                            ; preds = %bb145
-  br i1 undef, label %bb148, label %bb153
+  br i1 %arg, label %bb148, label %bb153
 
 bb148:                                            ; preds = %bb146
-  br i1 undef, label %bb155, label %bb149
+  br i1 %arg, label %bb155, label %bb149
 
 bb149:                                            ; preds = %bb148
-  br i1 undef, label %bb150, label %bb153
+  br i1 %arg, label %bb150, label %bb153
 
 bb150:                                            ; preds = %bb149
   br label %bb155
@@ -705,7 +705,7 @@ bb153:                                            ; preds = %bb158, %bb149, %bb1
   unreachable
 
 bb155:                                            ; preds = %bb150, %bb148
-  br i1 undef, label %bb157, label %bb156
+  br i1 %arg, label %bb157, label %bb156
 
 bb156:                                            ; preds = %bb155
   br label %bb158
@@ -714,10 +714,10 @@ bb157:                                            ; preds = %bb155
   br label %bb158
 
 bb158:                                            ; preds = %bb157, %bb156
-  br i1 undef, label %bb160, label %bb153
+  br i1 %arg, label %bb160, label %bb153
 
 bb160:                                            ; preds = %bb158
-  br i1 undef, label %bb162, label %bb161
+  br i1 %arg, label %bb162, label %bb161
 
 bb161:                                            ; preds = %bb160
   br label %bb163
@@ -726,16 +726,16 @@ bb162:                                            ; preds = %bb160
   br label %bb163
 
 bb163:                                            ; preds = %bb162, %bb161
-  br i1 undef, label %bb165, label %bb164
+  br i1 %arg, label %bb165, label %bb164
 
 bb164:                                            ; preds = %bb163
   br label %bb165
 
 bb165:                                            ; preds = %bb164, %bb163
-  br i1 undef, label %bb170, label %bb166
+  br i1 %arg, label %bb170, label %bb166
 
 bb166:                                            ; preds = %bb165
-  br i1 undef, label %bb167, label %bb168
+  br i1 %arg, label %bb167, label %bb168
 
 bb167:                                            ; preds = %bb166
   unreachable
@@ -744,25 +744,25 @@ bb168:                                            ; preds = %bb166
   unreachable
 
 bb170:                                            ; preds = %bb165
-  br i1 undef, label %bb215, label %bb171
+  br i1 %arg, label %bb215, label %bb171
 
 bb171:                                            ; preds = %bb170
-  br i1 undef, label %bb173, label %bb30
+  br i1 %arg, label %bb173, label %bb30
 
 bb173:                                            ; preds = %bb171
-  br i1 undef, label %bb174, label %bb215
+  br i1 %arg, label %bb174, label %bb215
 
 bb174:                                            ; preds = %bb173
-  br i1 undef, label %bb176, label %bb30
+  br i1 %arg, label %bb176, label %bb30
 
 bb176:                                            ; preds = %bb174
-  br i1 undef, label %bb178, label %bb30
+  br i1 %arg, label %bb178, label %bb30
 
 bb178:                                            ; preds = %bb176
-  br i1 undef, label %bb179, label %bb193
+  br i1 %arg, label %bb179, label %bb193
 
 bb179:                                            ; preds = %bb178
-  br i1 undef, label %bb181, label %bb180
+  br i1 %arg, label %bb181, label %bb180
 
 bb180:                                            ; preds = %bb179
   br label %bb182
@@ -771,23 +771,23 @@ bb181:                                            ; preds = %bb179
   br label %bb182
 
 bb182:                                            ; preds = %bb181, %bb180
-  br i1 undef, label %bb184, label %bb30
+  br i1 %arg, label %bb184, label %bb30
 
 bb184:                                            ; preds = %bb182
   %tmp185 = call ptr @returner()
-  br i1 undef, label %bb186, label %bb195
+  br i1 %arg, label %bb186, label %bb195
 
 bb186:                                            ; preds = %bb184
   %tmp188 = call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %tmp185)
   %tmp189 = call ptr @llvm.objc.retain(ptr %tmp188)
   call void @llvm.objc.release(ptr %tmp189), !clang.imprecise_release !0
-  br i1 undef, label %bb197, label %bb190
+  br i1 %arg, label %bb197, label %bb190
 
 bb190:                                            ; preds = %bb186
-  br i1 undef, label %bb192, label %bb195
+  br i1 %arg, label %bb192, label %bb195
 
 bb192:                                            ; preds = %bb190
-  br i1 undef, label %bb197, label %bb195
+  br i1 %arg, label %bb197, label %bb195
 
 bb193:                                            ; preds = %bb178
   br label %bb213
@@ -796,37 +796,37 @@ bb195:                                            ; preds = %bb192, %bb190, %bb1
   unreachable
 
 bb197:                                            ; preds = %bb192, %bb186
-  br i1 undef, label %bb198, label %bb215
+  br i1 %arg, label %bb198, label %bb215
 
 bb198:                                            ; preds = %bb197
-  br i1 undef, label %bb202, label %bb199
+  br i1 %arg, label %bb202, label %bb199
 
 bb199:                                            ; preds = %bb198
-  br i1 undef, label %bb201, label %bb30
+  br i1 %arg, label %bb201, label %bb30
 
 bb201:                                            ; preds = %bb199
   br label %bb202
 
 bb202:                                            ; preds = %bb201, %bb198
-  br i1 undef, label %bb206, label %bb203
+  br i1 %arg, label %bb206, label %bb203
 
 bb203:                                            ; preds = %bb202
-  br i1 undef, label %bb205, label %bb30
+  br i1 %arg, label %bb205, label %bb30
 
 bb205:                                            ; preds = %bb203
   br label %bb206
 
 bb206:                                            ; preds = %bb205, %bb202
-  br i1 undef, label %bb210, label %bb207
+  br i1 %arg, label %bb210, label %bb207
 
 bb207:                                            ; preds = %bb206
-  br i1 undef, label %bb209, label %bb30
+  br i1 %arg, label %bb209, label %bb30
 
 bb209:                                            ; preds = %bb207
   br label %bb210
 
 bb210:                                            ; preds = %bb209, %bb206
-  br i1 undef, label %bb212, label %bb30
+  br i1 %arg, label %bb212, label %bb30
 
 bb212:                                            ; preds = %bb210
   unreachable
@@ -838,19 +838,19 @@ bb214:                                            ; preds = %bb42
   br label %bb219
 
 bb215:                                            ; preds = %bb197, %bb173, %bb170, %bb141
-  br i1 undef, label %bb217, label %bb216
+  br i1 %arg, label %bb217, label %bb216
 
 bb216:                                            ; preds = %bb215
   br label %bb217
 
 bb217:                                            ; preds = %bb216, %bb215
-  br i1 undef, label %bb219, label %bb218
+  br i1 %arg, label %bb219, label %bb218
 
 bb218:                                            ; preds = %bb217
   br label %bb219
 
 bb219:                                            ; preds = %bb218, %bb217, %bb214
-  br i1 undef, label %bb221, label %bb220
+  br i1 %arg, label %bb221, label %bb220
 
 bb220:                                            ; preds = %bb219
   unreachable
@@ -863,7 +863,7 @@ bb222:                                            ; preds = %bb20, %bb19
 }
 
 ; Function Attrs: ssp
-define void @test3() #1 personality ptr @__gxx_personality_sj0 {
+define void @test3(i1 %arg) #1 personality ptr @__gxx_personality_sj0 {
 entry:
   %call2 = invoke ptr @objc_msgSend(ptr undef, ptr undef, ptr @_unnamed_cfstring)
           to label %invoke.cont unwind label %lpad
@@ -873,7 +873,7 @@ invoke.cont:                                      ; preds = %entry
           to label %invoke.cont4 unwind label %lpad3
 
 invoke.cont4:                                     ; preds = %invoke.cont
-  br i1 undef, label %land.end, label %land.rhs
+  br i1 %arg, label %land.end, label %land.rhs
 
 land.rhs:                                         ; preds = %invoke.cont4
   %call7 = invoke i32 @objc_msgSend(ptr undef, ptr undef)
@@ -884,7 +884,7 @@ land.end:                                         ; preds = %land.rhs, %invoke.c
           to label %invoke.cont.i unwind label %lpad.i
 
 invoke.cont.i:                                    ; preds = %land.end
-  br i1 undef, label %invoke.cont8, label %if.then.i
+  br i1 %arg, label %invoke.cont8, label %if.then.i
 
 if.then.i:                                        ; preds = %invoke.cont.i
   br label %invoke.cont8
@@ -907,7 +907,7 @@ invoke.cont21:                                    ; preds = %invoke.cont17
           to label %invoke.cont.i1980 unwind label %lpad.i1982
 
 invoke.cont.i1980:                                ; preds = %invoke.cont21
-  br i1 undef, label %invoke.cont24, label %if.then.i1981
+  br i1 %arg, label %invoke.cont24, label %if.then.i1981
 
 if.then.i1981:                                    ; preds = %invoke.cont.i1980
   br label %invoke.cont24
@@ -922,7 +922,7 @@ invoke.cont24:                                    ; preds = %if.then.i1981, %inv
           to label %invoke.cont36 unwind label %lpad35
 
 invoke.cont36:                                    ; preds = %invoke.cont24
-  br i1 undef, label %land.end43, label %land.rhs39
+  br i1 %arg, label %land.end43, label %land.rhs39
 
 land.rhs39:                                       ; preds = %invoke.cont36
   %call41 = invoke signext i8 @objc_msgSend(ptr undef, ptr undef, ptr @_unnamed_cfstring)
@@ -933,7 +933,7 @@ land.end43:                                       ; preds = %land.rhs39, %invoke
           to label %invoke.cont.i1986 unwind label %lpad.i1988
 
 invoke.cont.i1986:                                ; preds = %land.end43
-  br i1 undef, label %invoke.cont44, label %if.then.i1987
+  br i1 %arg, label %invoke.cont44, label %if.then.i1987
 
 if.then.i1987:                                    ; preds = %invoke.cont.i1986
   br label %invoke.cont44
@@ -948,7 +948,7 @@ invoke.cont44:                                    ; preds = %if.then.i1987, %inv
           to label %invoke.cont52 unwind label %lpad51
 
 invoke.cont52:                                    ; preds = %invoke.cont44
-  br i1 undef, label %land.end70, label %land.rhs58
+  br i1 %arg, label %land.end70, label %land.rhs58
 
 land.rhs58:                                       ; preds = %invoke.cont52
   %call63 = invoke ptr @objc_msgSend(ptr undef, ptr undef, i32 42)
@@ -963,7 +963,7 @@ land.end70:                                       ; preds = %invoke.cont62, %inv
           to label %invoke.cont.i1992 unwind label %lpad66.body
 
 invoke.cont.i1992:                                ; preds = %land.end70
-  br i1 undef, label %invoke.cont71, label %if.then.i1993
+  br i1 %arg, label %invoke.cont71, label %if.then.i1993
 
 if.then.i1993:                                    ; preds = %invoke.cont.i1992
   br label %invoke.cont71
@@ -973,7 +973,7 @@ invoke.cont71:                                    ; preds = %if.then.i1993, %inv
           to label %invoke.cont.i1998 unwind label %lpad.i2000
 
 invoke.cont.i1998:                                ; preds = %invoke.cont71
-  br i1 undef, label %invoke.cont91, label %if.then.i1999
+  br i1 %arg, label %invoke.cont91, label %if.then.i1999
 
 if.then.i1999:                                    ; preds = %invoke.cont.i1998
   br label %invoke.cont91
@@ -996,7 +996,7 @@ invoke.cont97:                                    ; preds = %invoke.cont95
           to label %invoke.cont.i2004 unwind label %lpad.i2006
 
 invoke.cont.i2004:                                ; preds = %invoke.cont97
-  br i1 undef, label %invoke.cont100, label %if.then.i2005
+  br i1 %arg, label %invoke.cont100, label %if.then.i2005
 
 if.then.i2005:                                    ; preds = %invoke.cont.i2004
   br label %invoke.cont100
@@ -1015,7 +1015,7 @@ invoke.cont110:                                   ; preds = %invoke.cont100
           to label %invoke.cont.i2010 unwind label %lpad.i2012
 
 invoke.cont.i2010:                                ; preds = %invoke.cont110
-  br i1 undef, label %invoke.cont117, label %if.then.i2011
+  br i1 %arg, label %invoke.cont117, label %if.then.i2011
 
 if.then.i2011:                                    ; preds = %invoke.cont.i2010
   br label %invoke.cont117
@@ -1094,7 +1094,7 @@ lpad109:                                          ; preds = %invoke.cont100
   unreachable
 
 invoke.cont.i2022:                                ; preds = %invoke.cont117
-  br i1 undef, label %invoke.cont157, label %if.then.i2023
+  br i1 %arg, label %invoke.cont157, label %if.then.i2023
 
 if.then.i2023:                                    ; preds = %invoke.cont.i2022
   br label %invoke.cont157
@@ -1104,7 +1104,7 @@ invoke.cont157:                                   ; preds = %if.then.i2023, %inv
           to label %invoke.cont.i2028 unwind label %lpad164.body
 
 invoke.cont.i2028:                                ; preds = %invoke.cont157
-  br i1 undef, label %invoke.cont165, label %if.then.i2029
+  br i1 %arg, label %invoke.cont165, label %if.then.i2029
 
 if.then.i2029:                                    ; preds = %invoke.cont.i2028
   br label %invoke.cont165
@@ -1122,7 +1122,7 @@ invoke.cont185:                                   ; preds = %invoke.cont184
           to label %invoke.cont.i2034 unwind label %lpad.i2036
 
 invoke.cont.i2034:                                ; preds = %invoke.cont185
-  br i1 undef, label %invoke.cont190, label %if.then.i2035
+  br i1 %arg, label %invoke.cont190, label %if.then.i2035
 
 if.then.i2035:                                    ; preds = %invoke.cont.i2034
   br label %invoke.cont190
@@ -1149,7 +1149,7 @@ invoke.cont204:                                   ; preds = %invoke.cont201
           to label %invoke.cont.i2040 unwind label %lpad.i2042
 
 invoke.cont.i2040:                                ; preds = %invoke.cont204
-  br i1 undef, label %invoke.cont207, label %if.then.i2041
+  br i1 %arg, label %invoke.cont207, label %if.then.i2041
 
 if.then.i2041:                                    ; preds = %invoke.cont.i2040
   br label %invoke.cont207
@@ -1168,7 +1168,7 @@ invoke.cont208:                                   ; preds = %invoke.cont207
           to label %invoke.cont.i2046 unwind label %lpad212.body
 
 invoke.cont.i2046:                                ; preds = %invoke.cont208
-  br i1 undef, label %invoke.cont213, label %if.then.i2047
+  br i1 %arg, label %invoke.cont213, label %if.then.i2047
 
 if.then.i2047:                                    ; preds = %invoke.cont.i2046
   br label %invoke.cont213
@@ -1186,7 +1186,7 @@ invoke.cont228:                                   ; preds = %invoke.cont221
           to label %invoke.cont.i2052 unwind label %lpad.i2054
 
 invoke.cont.i2052:                                ; preds = %invoke.cont228
-  br i1 undef, label %invoke.cont231, label %if.then.i2053
+  br i1 %arg, label %invoke.cont231, label %if.then.i2053
 
 if.then.i2053:                                    ; preds = %invoke.cont.i2052
   br label %invoke.cont231
@@ -1205,7 +1205,7 @@ invoke.cont232:                                   ; preds = %invoke.cont231
           to label %invoke.cont.i2058 unwind label %lpad236.body
 
 invoke.cont.i2058:                                ; preds = %invoke.cont232
-  br i1 undef, label %invoke.cont237, label %if.then.i2059
+  br i1 %arg, label %invoke.cont237, label %if.then.i2059
 
 if.then.i2059:                                    ; preds = %invoke.cont.i2058
   br label %invoke.cont237
@@ -1251,7 +1251,7 @@ invoke.cont278:                                   ; preds = %invoke.cont274
           to label %invoke.cont.i2064 unwind label %lpad.i2066
 
 invoke.cont.i2064:                                ; preds = %invoke.cont278
-  br i1 undef, label %invoke.cont281, label %if.then.i2065
+  br i1 %arg, label %invoke.cont281, label %if.then.i2065
 
 if.then.i2065:                                    ; preds = %invoke.cont.i2064
   br label %invoke.cont281
@@ -1286,7 +1286,7 @@ invoke.cont315:                                   ; preds = %invoke.cont312
           to label %invoke.cont321 unwind label %lpad320
 
 invoke.cont321:                                   ; preds = %invoke.cont315
-  br i1 undef, label %land.end344, label %land.rhs335
+  br i1 %arg, label %land.end344, label %land.rhs335
 
 land.rhs335:                                      ; preds = %invoke.cont321
   %call342 = invoke signext i8 @objc_msgSend(ptr undef, ptr undef, ptr @_unnamed_cfstring)
@@ -1297,7 +1297,7 @@ land.end344:                                      ; preds = %land.rhs335, %invok
           to label %invoke.cont.i2070 unwind label %lpad340.body
 
 invoke.cont.i2070:                                ; preds = %land.end344
-  br i1 undef, label %invoke.cont345, label %if.then.i2071
+  br i1 %arg, label %invoke.cont345, label %if.then.i2071
 
 if.then.i2071:                                    ; preds = %invoke.cont.i2070
   br label %invoke.cont345
@@ -1319,7 +1319,7 @@ invoke.cont370:                                   ; preds = %invoke.cont364
           to label %invoke.cont.i2076 unwind label %lpad.i2078
 
 invoke.cont.i2076:                                ; preds = %invoke.cont370
-  br i1 undef, label %invoke.cont373, label %if.then.i2077
+  br i1 %arg, label %invoke.cont373, label %if.then.i2077
 
 if.then.i2077:                                    ; preds = %invoke.cont.i2076
   br label %invoke.cont373
@@ -1346,7 +1346,7 @@ invoke.cont383:                                   ; preds = %invoke.cont382
           to label %invoke.cont.i2082 unwind label %lpad.i2084
 
 invoke.cont.i2082:                                ; preds = %invoke.cont383
-  br i1 undef, label %invoke.cont392, label %if.then.i2083
+  br i1 %arg, label %invoke.cont392, label %if.then.i2083
 
 if.then.i2083:                                    ; preds = %invoke.cont.i2082
   br label %invoke.cont392
@@ -1377,7 +1377,7 @@ invoke.cont402:                                   ; preds = %invoke.cont399
           to label %invoke.cont.i2088 unwind label %lpad.i2090
 
 invoke.cont.i2088:                                ; preds = %invoke.cont402
-  br i1 undef, label %invoke.cont405, label %if.then.i2089
+  br i1 %arg, label %invoke.cont405, label %if.then.i2089
 
 if.then.i2089:                                    ; preds = %invoke.cont.i2088
   br label %invoke.cont405
@@ -1404,7 +1404,7 @@ invoke.cont412:                                   ; preds = %invoke.cont409
           to label %invoke.cont.i2094 unwind label %lpad.i2096
 
 invoke.cont.i2094:                                ; preds = %invoke.cont412
-  br i1 undef, label %invoke.cont418, label %if.then.i2095
+  br i1 %arg, label %invoke.cont418, label %if.then.i2095
 
 if.then.i2095:                                    ; preds = %invoke.cont.i2094
   br label %invoke.cont418
@@ -1435,7 +1435,7 @@ invoke.cont429:                                   ; preds = %invoke.cont426
           to label %invoke.cont.i2100 unwind label %lpad.i2102
 
 invoke.cont.i2100:                                ; preds = %invoke.cont429
-  br i1 undef, label %invoke.cont432, label %if.then.i2101
+  br i1 %arg, label %invoke.cont432, label %if.then.i2101
 
 if.then.i2101:                                    ; preds = %invoke.cont.i2100
   br label %invoke.cont432
@@ -1467,7 +1467,7 @@ invoke.cont443:                                   ; preds = %invoke.cont.i2106
           to label %invoke.cont.i2112 unwind label %lpad.i2114
 
 invoke.cont.i2112:                                ; preds = %invoke.cont443
-  br i1 undef, label %invoke.cont449, label %if.then.i2113
+  br i1 %arg, label %invoke.cont449, label %if.then.i2113
 
 if.then.i2113:                                    ; preds = %invoke.cont.i2112
   br label %invoke.cont449
@@ -1490,7 +1490,7 @@ invoke.cont455:                                   ; preds = %invoke.cont452
           to label %invoke.cont.i2118 unwind label %lpad.i2120
 
 invoke.cont.i2118:                                ; preds = %invoke.cont455
-  br i1 undef, label %invoke.cont458, label %if.then.i2119
+  br i1 %arg, label %invoke.cont458, label %if.then.i2119
 
 if.then.i2119:                                    ; preds = %invoke.cont.i2118
   br label %invoke.cont458
@@ -1509,7 +1509,7 @@ invoke.cont460:                                   ; preds = %invoke.cont458
           to label %invoke.cont.i2124 unwind label %lpad.i2126
 
 invoke.cont.i2124:                                ; preds = %invoke.cont460
-  br i1 undef, label %invoke.cont466, label %if.then.i2125
+  br i1 %arg, label %invoke.cont466, label %if.then.i2125
 
 if.then.i2125:                                    ; preds = %invoke.cont.i2124
   br label %invoke.cont466
@@ -1528,7 +1528,7 @@ invoke.cont469:                                   ; preds = %invoke.cont466
           to label %invoke.cont.i2130 unwind label %lpad.i2132
 
 invoke.cont.i2130:                                ; preds = %invoke.cont469
-  br i1 undef, label %invoke.cont475, label %if.then.i2131
+  br i1 %arg, label %invoke.cont475, label %if.then.i2131
 
 if.then.i2131:                                    ; preds = %invoke.cont.i2130
   br label %invoke.cont475
@@ -1563,7 +1563,7 @@ invoke.cont509:                                   ; preds = %invoke.cont506
           to label %invoke.cont512 unwind label %lpad489
 
 invoke.cont512:                                   ; preds = %invoke.cont509
-  br i1 undef, label %msgSend.null-receiver, label %msgSend.call
+  br i1 %arg, label %msgSend.null-receiver, label %msgSend.call
 
 msgSend.call:                                     ; preds = %invoke.cont512
   invoke void @objc_msgSend_stret(ptr sret(%struct.CGPoint) undef, ptr undef, ptr undef)
@@ -1577,7 +1577,7 @@ msgSend.cont:                                     ; preds = %msgSend.null-receiv
           to label %invoke.cont.i2136 unwind label %lpad.i2138
 
 invoke.cont.i2136:                                ; preds = %msgSend.cont
-  br i1 undef, label %invoke.cont521, label %if.then.i2137
+  br i1 %arg, label %invoke.cont521, label %if.then.i2137
 
 if.then.i2137:                                    ; preds = %invoke.cont.i2136
   br label %invoke.cont521
@@ -1604,7 +1604,7 @@ invoke.cont534:                                   ; preds = %invoke.cont531
           to label %invoke.cont.i2142 unwind label %lpad.i2144
 
 invoke.cont.i2142:                                ; preds = %invoke.cont534
-  br i1 undef, label %invoke.cont540, label %if.then.i2143
+  br i1 %arg, label %invoke.cont540, label %if.then.i2143
 
 if.then.i2143:                                    ; preds = %invoke.cont.i2142
   br label %invoke.cont540
@@ -1918,31 +1918,31 @@ eh.resume:                                        ; preds = %lpad580, %ehcleanup
 
 @"OBJC_EHTYPE_$_NSException" = external global i8
 
-define void @test4() personality ptr @__objc_personality_v0 {
+define void @test4(i1 %arg) personality ptr @__objc_personality_v0 {
 entry:
-  br i1 undef, label %if.end13, label %if.then10
+  br i1 %arg, label %if.end13, label %if.then10
 
 if.then10:                                        ; preds = %entry
   br label %if.end13
 
 if.end13:                                         ; preds = %if.then10, %entry
   %0 = call ptr @objc_msgSend(ptr undef, ptr undef, ptr @_unnamed_cfstring, i64 2, ptr @_unnamed_cfstring_2, i8 signext 0), !clang.arc.no_objc_arc_exceptions !0
-  br i1 undef, label %if.then17, label %if.end18
+  br i1 %arg, label %if.then17, label %if.end18
 
 if.then17:                                        ; preds = %if.end13
   br label %if.end18
 
 if.end18:                                         ; preds = %if.then17, %if.end13
-  br i1 undef, label %if.then64, label %if.end73
+  br i1 %arg, label %if.then64, label %if.end73
 
 if.then64:                                        ; preds = %if.end18
-  br i1 undef, label %cond.end71, label %cond.true68
+  br i1 %arg, label %cond.end71, label %cond.true68
 
 cond.true68:                                      ; preds = %if.then64
   br label %cond.end71
 
 cond.end71:                                       ; preds = %cond.true68, %if.then64
-  br i1 undef, label %cleanup.action, label %cleanup.done
+  br i1 %arg, label %cleanup.action, label %cleanup.done
 
 cleanup.action:                                   ; preds = %cond.end71
   br label %cleanup.done
@@ -1951,7 +1951,7 @@ cleanup.done:                                     ; preds = %cleanup.action, %co
   br label %if.end73
 
 if.end73:                                         ; preds = %cleanup.done, %if.end18
-  br i1 undef, label %forcoll.empty, label %forcoll.loopinit
+  br i1 %arg, label %forcoll.empty, label %forcoll.loopinit
 
 forcoll.loopinit:                                 ; preds = %if.end73
   br label %forcoll.loopbody.outer
@@ -1960,34 +1960,34 @@ forcoll.loopbody.outer:                           ; preds = %forcoll.refetch, %f
   br label %forcoll.loopbody
 
 forcoll.loopbody:                                 ; preds = %forcoll.notmutated, %forcoll.loopbody.outer
-  br i1 undef, label %forcoll.notmutated, label %forcoll.mutated
+  br i1 %arg, label %forcoll.notmutated, label %forcoll.mutated
 
 forcoll.mutated:                                  ; preds = %forcoll.loopbody
   br label %forcoll.notmutated
 
 forcoll.notmutated:                               ; preds = %forcoll.mutated, %forcoll.loopbody
-  br i1 undef, label %forcoll.loopbody, label %forcoll.refetch
+  br i1 %arg, label %forcoll.loopbody, label %forcoll.refetch
 
 forcoll.refetch:                                  ; preds = %forcoll.notmutated
-  br i1 undef, label %forcoll.empty, label %forcoll.loopbody.outer
+  br i1 %arg, label %forcoll.empty, label %forcoll.loopbody.outer
 
 forcoll.empty:                                    ; preds = %forcoll.refetch, %if.end73
-  br i1 undef, label %if.end85, label %if.then82
+  br i1 %arg, label %if.end85, label %if.then82
 
 if.then82:                                        ; preds = %forcoll.empty
   br label %if.end85
 
 if.end85:                                         ; preds = %if.then82, %forcoll.empty
-  br i1 undef, label %if.then87, label %if.end102
+  br i1 %arg, label %if.then87, label %if.end102
 
 if.then87:                                        ; preds = %if.end85
-  br i1 undef, label %if.end94, label %if.then91
+  br i1 %arg, label %if.end94, label %if.then91
 
 if.then91:                                        ; preds = %if.then87
   br label %if.end94
 
 if.end94:                                         ; preds = %if.then91, %if.then87
-  br i1 undef, label %if.end101, label %if.then98
+  br i1 %arg, label %if.end101, label %if.then98
 
 if.then98:                                        ; preds = %if.end94
   br label %if.end101
@@ -1996,139 +1996,139 @@ if.end101:                                        ; preds = %if.then98, %if.end9
   br label %if.end102
 
 if.end102:                                        ; preds = %if.end101, %if.end85
-  br i1 undef, label %do.body113, label %if.then107
+  br i1 %arg, label %do.body113, label %if.then107
 
 if.then107:                                       ; preds = %if.end102
   br label %do.body113
 
 do.body113:                                       ; preds = %if.then107, %if.end102
-  br i1 undef, label %if.then116, label %if.end117
+  br i1 %arg, label %if.then116, label %if.end117
 
 if.then116:                                       ; preds = %do.body113
   br label %if.end117
 
 if.end117:                                        ; preds = %if.then116, %do.body113
-  br i1 undef, label %if.then125, label %if.end126
+  br i1 %arg, label %if.then125, label %if.end126
 
 if.then125:                                       ; preds = %if.end117
   br label %if.end126
 
 if.end126:                                        ; preds = %if.then125, %if.end117
-  br i1 undef, label %do.end166, label %cond.true132
+  br i1 %arg, label %do.end166, label %cond.true132
 
 cond.true132:                                     ; preds = %if.end126
-  br i1 undef, label %do.body148, label %cond.true151
+  br i1 %arg, label %do.body148, label %cond.true151
 
 do.body148:                                       ; preds = %cond.true132
-  br i1 undef, label %do.end166, label %cond.true151
+  br i1 %arg, label %do.end166, label %cond.true151
 
 cond.true151:                                     ; preds = %do.body148, %cond.true132
-  br i1 undef, label %if.then162, label %do.end166
+  br i1 %arg, label %if.then162, label %do.end166
 
 if.then162:                                       ; preds = %cond.true151
   br label %do.end166
 
 do.end166:                                        ; preds = %if.then162, %cond.true151, %do.body148, %if.end126
-  br i1 undef, label %if.then304, label %if.then170
+  br i1 %arg, label %if.then304, label %if.then170
 
 if.then170:                                       ; preds = %do.end166
-  br i1 undef, label %do.end193, label %cond.true179
+  br i1 %arg, label %do.end193, label %cond.true179
 
 cond.true179:                                     ; preds = %if.then170
-  br i1 undef, label %if.then190, label %do.end193
+  br i1 %arg, label %if.then190, label %do.end193
 
 if.then190:                                       ; preds = %cond.true179
   br label %do.end193
 
 do.end193:                                        ; preds = %if.then190, %cond.true179, %if.then170
-  br i1 undef, label %do.body200, label %do.body283
+  br i1 %arg, label %do.body200, label %do.body283
 
 do.body200:                                       ; preds = %do.end193
-  br i1 undef, label %do.end254, label %cond.true203
+  br i1 %arg, label %do.end254, label %cond.true203
 
 cond.true203:                                     ; preds = %do.body200
-  br i1 undef, label %do.body218, label %cond.true221
+  br i1 %arg, label %do.body218, label %cond.true221
 
 do.body218:                                       ; preds = %cond.true203
-  br i1 undef, label %do.end254, label %cond.true221
+  br i1 %arg, label %do.end254, label %cond.true221
 
 cond.true221:                                     ; preds = %do.body218, %cond.true203
-  br i1 undef, label %if.then232, label %do.body236
+  br i1 %arg, label %if.then232, label %do.body236
 
 if.then232:                                       ; preds = %cond.true221
   br label %do.body236
 
 do.body236:                                       ; preds = %if.then232, %cond.true221
-  br i1 undef, label %do.end254, label %cond.true239
+  br i1 %arg, label %do.end254, label %cond.true239
 
 cond.true239:                                     ; preds = %do.body236
-  br i1 undef, label %if.then250, label %do.end254
+  br i1 %arg, label %if.then250, label %do.end254
 
 if.then250:                                       ; preds = %cond.true239
   br label %do.end254
 
 do.end254:                                        ; preds = %if.then250, %cond.true239, %do.body236, %do.body218, %do.body200
-  br i1 undef, label %do.end277, label %cond.true263
+  br i1 %arg, label %do.end277, label %cond.true263
 
 cond.true263:                                     ; preds = %do.end254
-  br i1 undef, label %if.then274, label %do.end277
+  br i1 %arg, label %if.then274, label %do.end277
 
 if.then274:                                       ; preds = %cond.true263
   unreachable
 
 do.end277:                                        ; preds = %cond.true263, %do.end254
-  br i1 undef, label %if.then280, label %do.body283
+  br i1 %arg, label %if.then280, label %do.body283
 
 if.then280:                                       ; preds = %do.end277
   br label %do.body283
 
 do.body283:                                       ; preds = %if.then280, %do.end277, %do.end193
-  br i1 undef, label %if.end301, label %cond.true286
+  br i1 %arg, label %if.end301, label %cond.true286
 
 cond.true286:                                     ; preds = %do.body283
-  br i1 undef, label %if.then297, label %if.end301
+  br i1 %arg, label %if.then297, label %if.end301
 
 if.then297:                                       ; preds = %cond.true286
   br label %if.end301
 
 if.end301:                                        ; preds = %if.then297, %cond.true286, %do.body283
-  br i1 undef, label %if.then304, label %do.body351
+  br i1 %arg, label %if.then304, label %do.body351
 
 if.then304:                                       ; preds = %if.end301, %do.end166
-  br i1 undef, label %do.body309.lr.ph, label %do.body351
+  br i1 %arg, label %do.body309.lr.ph, label %do.body351
 
 do.body309.lr.ph:                                 ; preds = %if.then304
   br label %do.body309
 
 do.body309:                                       ; preds = %for.cond.backedge, %do.body309.lr.ph
-  br i1 undef, label %do.end328, label %cond.true312
+  br i1 %arg, label %do.end328, label %cond.true312
 
 cond.true312:                                     ; preds = %do.body309
-  br i1 undef, label %if.then323, label %do.end328
+  br i1 %arg, label %if.then323, label %do.end328
 
 if.then323:                                       ; preds = %cond.true312
   br label %do.end328
 
 do.end328:                                        ; preds = %if.then323, %cond.true312, %do.body309
-  br i1 undef, label %for.cond.backedge, label %cond.true335
+  br i1 %arg, label %for.cond.backedge, label %cond.true335
 
 for.cond.backedge:                                ; preds = %if.then346, %cond.true335, %do.end328
-  br i1 undef, label %do.body309, label %do.body351
+  br i1 %arg, label %do.body309, label %do.body351
 
 cond.true335:                                     ; preds = %do.end328
-  br i1 undef, label %if.then346, label %for.cond.backedge
+  br i1 %arg, label %if.then346, label %for.cond.backedge
 
 if.then346:                                       ; preds = %cond.true335
   br label %for.cond.backedge
 
 do.body351:                                       ; preds = %for.cond.backedge, %if.then304, %if.end301
-  br i1 undef, label %if.then354, label %if.end355
+  br i1 %arg, label %if.then354, label %if.end355
 
 if.then354:                                       ; preds = %do.body351
   br label %if.end355
 
 if.end355:                                        ; preds = %if.then354, %do.body351
-  br i1 undef, label %if.else, label %if.then364
+  br i1 %arg, label %if.else, label %if.then364
 
 if.then364:                                       ; preds = %if.end355
   br label %do.body366
@@ -2137,7 +2137,7 @@ if.else:                                          ; preds = %if.end355
   br label %do.body366
 
 do.body366:                                       ; preds = %if.else, %if.then364
-  br i1 undef, label %if.then369, label %if.end377.critedge
+  br i1 %arg, label %if.then369, label %if.end377.critedge
 
 if.then369:                                       ; preds = %do.body366
   br label %if.end377
@@ -2146,7 +2146,7 @@ if.end377.critedge:                               ; preds = %do.body366
   br label %if.end377
 
 if.end377:                                        ; preds = %if.end377.critedge, %if.then369
-  br i1 undef, label %if.then383, label %if.end392.critedge
+  br i1 %arg, label %if.then383, label %if.end392.critedge
 
 if.then383:                                       ; preds = %if.end377
   br label %if.end392
@@ -2155,7 +2155,7 @@ if.end392.critedge:                               ; preds = %if.end377
   br label %if.end392
 
 if.end392:                                        ; preds = %if.end392.critedge, %if.then383
-  br i1 undef, label %if.then398, label %if.end399
+  br i1 %arg, label %if.then398, label %if.end399
 
 if.then398:                                       ; preds = %if.end392
   br label %if.end399
@@ -2165,7 +2165,7 @@ if.end399:                                        ; preds = %if.then398, %if.end
           to label %eh.cont unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0
 
 eh.cont:                                          ; preds = %if.end399
-  br i1 undef, label %if.then430, label %if.end439.critedge
+  br i1 %arg, label %if.then430, label %if.end439.critedge
 
 if.then430:                                       ; preds = %eh.cont
   %1 = call ptr @llvm.objc.retain(ptr %0)

>From 9e2a747e45c780ca3740534e5913dbde3c91385d Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 19:21:29 -0700
Subject: [PATCH 2/9] Remove br i1 undef in Reassociate directory

---
 llvm/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll | 6 +++---
 llvm/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll | 4 ++--
 llvm/test/Transforms/Reassociate/add_across_block_crash.ll  | 6 +++---
 llvm/test/Transforms/Reassociate/infloop-deadphi.ll         | 6 +++---
 llvm/test/Transforms/Reassociate/reassociate-landingpad.ll  | 4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/llvm/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll b/llvm/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll
index 4cde69bb0c7ddf..80a9e77030e643 100644
--- a/llvm/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll
+++ b/llvm/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll
@@ -3,7 +3,7 @@
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
 target triple = "i386-gnu-linux"
 
-define void @exp_averages_intraday__deviation() {
+define void @exp_averages_intraday__deviation(i1 %arg) {
 entry:
   %0 = load i32, ptr undef, align 4
   %1 = shl i32 %0, 2
@@ -16,14 +16,14 @@ entry:
   br i1 false, label %"4", label %"12"
 
 "4":                                              ; preds = %entry
-  br i1 undef, label %"5", label %"8"
+  br i1 %arg, label %"5", label %"8"
 
 "5":                                              ; preds = %"4"
   unreachable
 
 "8":                                              ; preds = %"4"
   %8 = getelementptr inbounds i8, ptr undef, i32 %6
-  br i1 undef, label %"13", label %"12"
+  br i1 %arg, label %"13", label %"12"
 
 "12":                                             ; preds = %"8", %entry
   ret void
diff --git a/llvm/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll b/llvm/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll
index 650aa82c1af2f1..ba730758a1f26f 100644
--- a/llvm/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll
+++ b/llvm/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll
@@ -1,14 +1,14 @@
 ; RUN: opt < %s -passes=reassociate -disable-output
 ; PR13041
 
-define void @foo() {
+define void @foo(i1 %arg) {
 entry:
   br label %while.cond
 
 while.cond:                                       ; preds = %while.body, %entry
   %b.0 = phi i32 [ undef, %entry ], [ %sub2, %while.body ]
   %c.0 = phi i32 [ undef, %entry ], [ %sub3, %while.body ]
-  br i1 undef, label %while.end, label %while.body
+  br i1 %arg, label %while.end, label %while.body
 
 while.body:                                       ; preds = %while.cond
   %sub = sub nsw i32 0, %b.0
diff --git a/llvm/test/Transforms/Reassociate/add_across_block_crash.ll b/llvm/test/Transforms/Reassociate/add_across_block_crash.ll
index 26e971266d3443..a89f81154f3eb5 100644
--- a/llvm/test/Transforms/Reassociate/add_across_block_crash.ll
+++ b/llvm/test/Transforms/Reassociate/add_across_block_crash.ll
@@ -3,10 +3,10 @@
 ; This test is to make sure while processing a block, uses of instructions
 ; from a different basic block don't get added to be re-optimized
 
-define  void @main() {
+define  void @main(i1 %arg) {
 ; CHECK-LABEL: @main(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label %bb1, label %bb2
+; CHECK-NEXT:    br i1 %arg, label %bb1, label %bb2
 ; CHECK:       bb1:
 ; CHECK-NEXT:    ret void
 ; CHECK:       bb2:
@@ -14,7 +14,7 @@ define  void @main() {
 ;
 entry:
   %0 = fadd fast float undef, undef
-  br i1 undef, label %bb1, label %bb2
+  br i1 %arg, label %bb1, label %bb2
 
 bb1:
   %1 = fmul fast float undef, -2.000000e+00
diff --git a/llvm/test/Transforms/Reassociate/infloop-deadphi.ll b/llvm/test/Transforms/Reassociate/infloop-deadphi.ll
index 5b19f8d384f4da..3202f450b7566f 100644
--- a/llvm/test/Transforms/Reassociate/infloop-deadphi.ll
+++ b/llvm/test/Transforms/Reassociate/infloop-deadphi.ll
@@ -3,14 +3,14 @@
 
 target triple = "x86_64-unknown-linux-gnu"
 
-define void @f() {
+define void @f(i1 %arg) {
 ; CHECK-LABEL: @f(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[DONE:%.*]]
 ; CHECK:       dead:
 ; CHECK-NEXT:    [[XOR0:%.*]] = xor i16 [[XOR1:%.*]], undef
 ; CHECK-NEXT:    [[XOR1]] = xor i16 [[XOR0]], undef
-; CHECK-NEXT:    br i1 undef, label [[DEAD:%.*]], label [[DONE]]
+; CHECK-NEXT:    br i1 %arg, label [[DEAD:%.*]], label [[DONE]]
 ; CHECK:       done:
 ; CHECK-NEXT:    ret void
 ;
@@ -20,7 +20,7 @@ entry:
 dead:
   %xor0 = xor i16 %xor1, undef
   %xor1 = xor i16 %xor0, undef
-  br i1 undef, label %dead, label %done
+  br i1 %arg, label %dead, label %done
 
 done:
   %e = phi i16 [ %xor1, %dead ], [ 0, %entry ]
diff --git a/llvm/test/Transforms/Reassociate/reassociate-landingpad.ll b/llvm/test/Transforms/Reassociate/reassociate-landingpad.ll
index eb6a5cabb7be84..c5bd62e2763b67 100644
--- a/llvm/test/Transforms/Reassociate/reassociate-landingpad.ll
+++ b/llvm/test/Transforms/Reassociate/reassociate-landingpad.ll
@@ -14,7 +14,7 @@ declare i32 @__gxx_personality_v0(...)
 
 declare void @b() #0
 
-define void @a() #0 personality ptr @__gxx_personality_v0 {
+define void @a(i1 %arg) #0 personality ptr @__gxx_personality_v0 {
 ", bb1":
   invoke void @b()
           to label %invoke.cont unwind label %"bb22"
@@ -39,7 +39,7 @@ define void @a() #0 personality ptr @__gxx_personality_v0 {
   unreachable
 
 invoke.cont:                                      ; preds = %", bb1"
-  br i1 undef, label %", bb15", label %", bb8"
+  br i1 %arg, label %", bb15", label %", bb8"
 
 invoke.cont25:                                    ; preds = %", bb8"
   unreachable

>From 8dae2d78d8b08399d8e1fac7d125a0a4617121c4 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 19:42:54 -0700
Subject: [PATCH 3/9] Remove br i1 undef in SCCP directory

---
 .../SCCP/2004-12-10-UndefBranchBug.ll         | 11 ++-
 .../SCCP/2006-10-23-IPSCCP-Crash.ll           |  4 +-
 .../SCCP/2008-01-27-UndefCorrelate.ll         | 22 +++++-
 llvm/test/Transforms/SCCP/PR26044.ll          | 23 +++---
 llvm/test/Transforms/SCCP/crash.ll            |  4 +-
 llvm/test/Transforms/SCCP/domtree-update.ll   |  6 +-
 .../Transforms/SCCP/fp-bc-icmp-const-fold.ll  | 10 +--
 .../Transforms/SCCP/ipsccp-preserve-pdt.ll    | 11 +--
 .../SCCP/pr49582-iterator-invalidation.ll     |  8 +--
 llvm/test/Transforms/SCCP/return-zapped.ll    | 32 +++++----
 ...fter-each-resolving-undefs-for-function.ll | 34 +++++----
 .../SCCP/switch-constantfold-crash.ll         | 72 +++++++++++--------
 12 files changed, 138 insertions(+), 99 deletions(-)

diff --git a/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll b/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
index 2098b0390b64a2..e84ac516b9f50c 100644
--- a/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
+++ b/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
@@ -1,14 +1,13 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes=sccp -S | FileCheck %s
 
-; Branch on undef is UB, so the T block is never executed, and we can return
-; undef (IPSCCP would replace the block with unreachable).
-
-define i32 @foo() {
+define i32 @foo(i1 %arg) {
 ; CHECK-LABEL: @foo(
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG:%.*]], label [[T:%.*]], label [[T]]
+; CHECK:       T:
+; CHECK-NEXT:    ret i32 1
 ;
-  br i1 undef, label %T, label %T
+  br i1 %arg, label %T, label %T
 T:
   %X = add i32 0, 1
   ret i32 %X
diff --git a/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll b/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
index 3e2cfe1ce25fbe..8c1687a3eb7847 100644
--- a/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
+++ b/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
@@ -6,7 +6,7 @@ target triple = "powerpc-unknown-linux-gnu"
 @JUMP = external global i32		; <ptr> [#uses=1]
 @old_D_pat = external global [16 x i8]		; <ptr> [#uses=0]
 
-define void @asearch1(i32 %D) {
+define void @asearch1(i32 %D, i1 %arg) {
 entry:
 	%tmp80 = icmp ult i32 0, %D		; <i1> [#uses=1]
 	br i1 %tmp80, label %bb647.preheader, label %cond_true81.preheader
@@ -22,7 +22,7 @@ cond_true612:		; preds = %cond_true654
 cond_next624:		; preds = %cond_true654
 	ret void
 cond_true654:		; preds = %bb647.preheader
-	br i1 undef, label %cond_true612, label %cond_next624
+	br i1 %arg, label %cond_true612, label %cond_next624
 UnifiedReturnBlock:		; preds = %bb647.preheader
 	ret void
 }
diff --git a/llvm/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll b/llvm/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
index 6f499f27a65a91..895b1393dadaef 100644
--- a/llvm/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
+++ b/llvm/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
@@ -2,12 +2,30 @@
 ; RUN: opt < %s -passes=sccp -S | FileCheck %s
 ; PR1938
 
-define i32 @main() {
+define i32 @main(i1 %arg) {
 ; 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 [[ARG:%.*]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
+; CHECK:       cond_true:
+; CHECK-NEXT:    [[TMP97:%.*]] = icmp slt i32 [[K]], 10
+; CHECK-NEXT:    br i1 [[TMP97]], 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
@@ -15,7 +33,7 @@ entry:
 bb:
   %indvar = phi i32 [ 0, %entry ], [ %k, %bb.backedge ]
   %k = add i32 %indvar, 1
-  br i1 undef, label %cond_true, label %cond_false
+  br i1 %arg, label %cond_true, label %cond_false
 
 cond_true:
   %tmp97 = icmp slt i32 %k, 10
diff --git a/llvm/test/Transforms/SCCP/PR26044.ll b/llvm/test/Transforms/SCCP/PR26044.ll
index 90ac3101d0c23f..f786629f47d0e3 100644
--- a/llvm/test/Transforms/SCCP/PR26044.ll
+++ b/llvm/test/Transforms/SCCP/PR26044.ll
@@ -3,13 +3,13 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-define void @fn2(ptr %P) {
+define void @fn2(ptr %P, i1 %arg) {
 ; CHECK-LABEL: define {{[^@]+}}@fn2
-; CHECK-SAME: (ptr [[P:%.*]]) {
+; CHECK-SAME: (ptr [[P:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[IF_END:%.*]]
 ; CHECK:       for.cond1:
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG]], label [[IF_END]], label [[IF_END]]
 ; CHECK:       if.end:
 ; CHECK-NEXT:    [[CALL:%.*]] = call i32 @fn1(i32 undef)
 ; CHECK-NEXT:    store i32 [[CALL]], ptr [[P]], align 4
@@ -19,7 +19,7 @@ entry:
   br label %if.end
 
 for.cond1:                                        ; preds = %if.end, %for.end
-  br i1 undef, label %if.end, label %if.end
+  br i1 %arg, label %if.end, label %if.end
 
 if.end:                                           ; preds = %lbl, %for.cond1
   %e.2 = phi ptr [ undef, %entry ], [ null, %for.cond1 ], [ null, %for.cond1 ]
@@ -43,15 +43,16 @@ entry:
   ret i32 %cond
 }
 
-define void @fn_no_null_opt(ptr %P) #0 {
+define void @fn_no_null_opt(ptr %P, i1 %arg) #0 {
 ; CHECK-LABEL: define {{[^@]+}}@fn_no_null_opt
-; CHECK-SAME: (ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: (ptr [[P:%.*]], i1 [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[IF_END:%.*]]
 ; CHECK:       for.cond1:
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG]], label [[IF_END]], label [[IF_END]]
 ; CHECK:       if.end:
-; CHECK-NEXT:    [[CALL:%.*]] = call i32 @fn0(i32 undef)
+; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr null, align 4
+; CHECK-NEXT:    [[CALL:%.*]] = call i32 @fn0(i32 [[TMP0]])
 ; CHECK-NEXT:    store i32 [[CALL]], ptr [[P]], align 4
 ; CHECK-NEXT:    br label [[FOR_COND1:%.*]]
 ;
@@ -59,7 +60,7 @@ entry:
   br label %if.end
 
 for.cond1:                                        ; preds = %if.end, %for.end
-  br i1 undef, label %if.end, label %if.end
+  br i1 %arg, label %if.end, label %if.end
 
 if.end:                                           ; preds = %lbl, %for.cond1
   %e.2 = phi ptr [ undef, %entry ], [ null, %for.cond1 ], [ null, %for.cond1 ]
@@ -73,8 +74,8 @@ define internal i32 @fn0(i32 %p1) {
 ; CHECK-LABEL: define {{[^@]+}}@fn0
 ; CHECK-SAME: (i32 [[P1:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i32 undef, 0
-; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i32 undef, i32 undef
+; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i32 [[P1]], 0
+; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i32 [[P1]], i32 [[P1]]
 ; CHECK-NEXT:    ret i32 [[COND]]
 ;
 entry:
diff --git a/llvm/test/Transforms/SCCP/crash.ll b/llvm/test/Transforms/SCCP/crash.ll
index 47d9329f6f03da..9001b42850c25e 100644
--- a/llvm/test/Transforms/SCCP/crash.ll
+++ b/llvm/test/Transforms/SCCP/crash.ll
@@ -2,9 +2,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"
 target triple = "x86_64-apple-darwin10.0"
 
-define void @test1(i8 %arg) {
+define void @test1(i8 %arg, i1 %arg1) {
 entry:
-  br i1 undef, label %return, label %bb
+  br i1 %arg1, label %return, label %bb
 
 bb:   
   br label %bb34
diff --git a/llvm/test/Transforms/SCCP/domtree-update.ll b/llvm/test/Transforms/SCCP/domtree-update.ll
index 76f575c4e9c6d4..270da0e2f2bfe7 100644
--- a/llvm/test/Transforms/SCCP/domtree-update.ll
+++ b/llvm/test/Transforms/SCCP/domtree-update.ll
@@ -4,7 +4,7 @@
 
 ; DTU should not crash.
 
-define i32 @test() {
+define i32 @test(i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
@@ -25,10 +25,10 @@ if.then2:                                         ; preds = %for.body
   br label %for.inc
 
 if.else:                                          ; preds = %for.body
-  br i1 undef, label %lor.rhs, label %if.then19.critedge
+  br i1 %arg, label %lor.rhs, label %if.then19.critedge
 
 lor.rhs:                                          ; preds = %if.else
-  br i1 undef, label %if.then19, label %for.inc
+  br i1 %arg, label %if.then19, label %for.inc
 
 if.then19.critedge:                               ; preds = %if.else
   br label %if.then19
diff --git a/llvm/test/Transforms/SCCP/fp-bc-icmp-const-fold.ll b/llvm/test/Transforms/SCCP/fp-bc-icmp-const-fold.ll
index 8061a0396ee4c8..6a8b52d0ac4814 100644
--- a/llvm/test/Transforms/SCCP/fp-bc-icmp-const-fold.ll
+++ b/llvm/test/Transforms/SCCP/fp-bc-icmp-const-fold.ll
@@ -2,18 +2,18 @@
 target datalayout = "E-m:e-i64:64-n32:64"
 target triple = "powerpc64le-unknown-linux"
 
-define void @test(i32 signext %n) {
+define void @test(i32 signext %n, i1 %arg) {
 
 ; CHECK-LABEL: @test
 
 entry:
-  br i1 undef, label %if.then, label %if.end
+  br i1 %arg, label %if.then, label %if.end
 
 if.then:                                          ; preds = %entry
   ret void
 
 if.end:                                           ; preds = %entry
-  br i1 undef, label %if.then2, label %if.end4
+  br i1 %arg, label %if.then2, label %if.end4
 
 if.then2:                                         ; preds = %if.end
   unreachable
@@ -36,10 +36,10 @@ if.else14:                                        ; preds = %if.end4
 
 do.body:                                          ; preds = %do.body, %if.else14
   %scale.0 = phi ppc_fp128 [ 0xM3FF00000000000000000000000000000, %if.else14 ], [ %scale.0, %do.body ]
-  br i1 undef, label %do.body, label %if.then33
+  br i1 %arg, label %do.body, label %if.then33
 
 if.then33:                                        ; preds = %do.body
-  br i1 undef, label %_ZN5boost4math4signIgEEiRKT_.exit30, label %cond.false.i28
+  br i1 %arg, label %_ZN5boost4math4signIgEEiRKT_.exit30, label %cond.false.i28
 
 cond.false.i28:                                   ; preds = %if.then33
   %0 = bitcast ppc_fp128 %scale.0 to i128
diff --git a/llvm/test/Transforms/SCCP/ipsccp-preserve-pdt.ll b/llvm/test/Transforms/SCCP/ipsccp-preserve-pdt.ll
index f8c8e33dfc2335..be05d96f085741 100644
--- a/llvm/test/Transforms/SCCP/ipsccp-preserve-pdt.ll
+++ b/llvm/test/Transforms/SCCP/ipsccp-preserve-pdt.ll
@@ -20,16 +20,17 @@
 ; CHECK-NEXT:    [2] %for.body {4294967295,4294967295} [1]
 ; CHECK-NEXT:    [2] %if.end4 {4294967295,4294967295} [1]
 ; CHECK-NEXT:      [3] %entry {4294967295,4294967295} [2]
-; CHECK-NEXT:    [2] %for.cond34 {4294967295,4294967295} [1]
-; CHECK-NEXT:      [3] %for.cond16 {4294967295,4294967295} [2]
-; CHECK-NEXT: Roots: %for.body %for.cond34
+; CHECK-NEXT:    [2] %for.body37 {4294967295,4294967295} [1]
+; CHECK-NEXT:      [3] %for.cond34 {4294967295,4294967295} [2]
+; CHECK-NEXT:        [4] %for.cond16 {4294967295,4294967295} [3]
+; CHECK-NEXT: Roots: %for.body %for.body37
 ; CHECK-NEXT: PostDominatorTree for function: bar
 ; CHECK-NOT: <badref>
 
 declare hidden i1 @compare(ptr) align 2
 declare hidden { i8, ptr } @getType(ptr) align 2
 
-define internal void @foo(ptr %TLI, ptr %DL, ptr %Ty, ptr %ValueVTs, ptr %Offsets, i64 %StartingOffset) {
+define internal void @foo(ptr %TLI, ptr %DL, ptr %Ty, ptr %ValueVTs, ptr %Offsets, i64 %StartingOffset, i1 %arg) {
 entry:
   %VT = alloca i64, align 8
   br i1 false, label %if.then, label %if.end4
@@ -51,7 +52,7 @@ for.cond16:                                       ; preds = %for.cond34, %if.end
   br label %for.cond34
 
 for.cond34:                                       ; preds = %for.body37, %for.cond16
-  br i1 undef, label %for.body37, label %for.cond16
+  br i1 %arg, label %for.body37, label %for.cond16
 
 for.body37:                                       ; preds = %for.cond34
   %tobool39 = icmp ne ptr %Offsets, null
diff --git a/llvm/test/Transforms/SCCP/pr49582-iterator-invalidation.ll b/llvm/test/Transforms/SCCP/pr49582-iterator-invalidation.ll
index ed5703da35e6f6..1ba6e9734e642c 100644
--- a/llvm/test/Transforms/SCCP/pr49582-iterator-invalidation.ll
+++ b/llvm/test/Transforms/SCCP/pr49582-iterator-invalidation.ll
@@ -5,7 +5,7 @@
 @c = external dso_local global ptr, align 8
 @d = external dso_local global i32, align 4
 
-define void @f(i32 %i) {
+define void @f(i32 %i, i1 %arg) {
 entry:
   br label %for.cond
 
@@ -474,7 +474,7 @@ if.then312:                                       ; preds = %if.then309
   br label %if.end628
 
 if.else316:                                       ; preds = %if.then309
-  br i1 undef, label %if.then318, label %if.end628
+  br i1 %arg, label %if.then318, label %if.end628
 
 if.then318:                                       ; preds = %if.else316
   %idxprom320 = sext i32 %add310 to i64
@@ -726,7 +726,7 @@ if.then499:                                       ; preds = %if.else496
   br label %if.end628
 
 if.else501:                                       ; preds = %if.else496
-  br i1 undef, label %if.then503, label %if.end628
+  br i1 %arg, label %if.then503, label %if.end628
 
 if.then503:                                       ; preds = %if.else501
   br label %if.end628
@@ -834,7 +834,7 @@ if.then596:                                       ; preds = %if.then593
   br label %if.end628
 
 if.else600:                                       ; preds = %if.then593
-  br i1 undef, label %if.then602, label %if.end628
+  br i1 %arg, label %if.then602, label %if.end628
 
 if.then602:                                       ; preds = %if.else600
   %idxprom604 = sext i32 %add594 to i64
diff --git a/llvm/test/Transforms/SCCP/return-zapped.ll b/llvm/test/Transforms/SCCP/return-zapped.ll
index 6d705001250930..2b0a7942943c8f 100644
--- a/llvm/test/Transforms/SCCP/return-zapped.ll
+++ b/llvm/test/Transforms/SCCP/return-zapped.ll
@@ -1,37 +1,41 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
 ; RUN: opt < %s -S -passes=ipsccp | FileCheck %s
 
-; testf() performs an unconditional branch on undef, as such the testf() return
-; value used in test1() will remain "unknown" and the following branch on it
-; replaced by unreachable. This is fine, as the call to testf() will already
-; trigger undefined behavior.
-define void @test1() {
-; CHECK-LABEL: define {{[^@]+}}@test1() {
+define void @test1(i1 %arg) {
+; CHECK-LABEL: define {{[^@]+}}@test1
+; CHECK-SAME: (i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[IF_THEN:%.*]]
 ; CHECK:       if.then:
-; CHECK-NEXT:    [[CALL:%.*]] = call i1 @testf()
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    [[CALL:%.*]] = call i1 @testf(i1 [[ARG]])
+; CHECK-NEXT:    br label [[IF_END:%.*]]
+; CHECK:       if.end:
+; CHECK-NEXT:    ret void
 ;
 entry:
   br label %if.then
 if.then:                                          ; preds = %entry, %if.then
   %foo = phi i32 [ 0, %entry], [ %next, %if.then]
   %next = add i32 %foo, 1
-  %call = call i1 @testf()
+  %call = call i1 @testf(i1 %arg)
   br i1 %call, label %if.end, label %if.then
 
 if.end:                                           ; preds = %if.then, %entry
   ret void
 }
 
-define internal i1 @testf() {
-; CHECK-LABEL: define {{[^@]+}}@testf() {
+define internal i1 @testf(i1 %arg) {
+; CHECK-LABEL: define {{[^@]+}}@testf
+; CHECK-SAME: (i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG]], label [[IF_THEN1:%.*]], label [[IF_END3:%.*]]
+; CHECK:       if.then1:
+; CHECK-NEXT:    br label [[IF_END3]]
+; CHECK:       if.end3:
+; CHECK-NEXT:    ret i1 true
 ;
 entry:
-  br i1 undef, label %if.then1, label %if.end3
+  br i1 %arg, label %if.then1, label %if.end3
 
 if.then1:                                         ; preds = %if.end
   br label %if.end3
@@ -47,7 +51,7 @@ define i1 @test2() {
 ; CHECK-NEXT:    br label [[IF_END:%.*]]
 ; CHECK:       if.end:
 ; CHECK-NEXT:    [[CALL2:%.*]] = call i1 @testf()
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 [[CALL2]]
 ;
 entry:
   br label %if.end
diff --git a/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll b/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
index 05f3358045c3c4..e3048b2a6ac7f0 100644
--- a/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
+++ b/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
@@ -1,22 +1,23 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
 
-;
-define internal i32 @testf(i1 %c) {
-; CHECK-LABEL: define internal i32 @testf(
-; CHECK-SAME: i1 [[C:%.*]]) {
+define internal i32 @testf(i1 %c, i1 %arg) {
+; CHECK-LABEL: define internal range(i32 10, 12) i32 @testf(
+; CHECK-SAME: i1 [[C:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    br i1 [[C]], label %[[IF_COND:.*]], label %[[IF_END:.*]]
 ; CHECK:       [[IF_COND]]:
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG]], label %[[IF_THEN:.*]], label %[[IF_END]]
+; CHECK:       [[IF_THEN]]:
+; CHECK-NEXT:    ret i32 11
 ; CHECK:       [[IF_END]]:
-; CHECK-NEXT:    ret i32 poison
+; CHECK-NEXT:    ret i32 10
 ;
 entry:
   br i1 %c, label %if.cond, label %if.end
 
 if.cond:
-  br i1 undef, label %if.then, label %if.end
+  br i1 %arg, label %if.then, label %if.end
 
 if.then:                                          ; preds = %entry, %if.then
   ret i32 11
@@ -26,22 +27,25 @@ if.end:                                          ; preds = %if.then1, %entry
 }
 
 ;
-define internal i32 @test1(i1 %c) {
-; CHECK-LABEL: define internal i32 @test1(
-; CHECK-SAME: i1 [[C:%.*]]) {
+define internal i32 @test1(i1 %c, i1 %arg) {
+; CHECK-LABEL: define internal range(i32 0, 100) i32 @test1(
+; CHECK-SAME: i1 [[C:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
 ; CHECK-NEXT:    br label %[[IF_THEN:.*]]
 ; CHECK:       [[IF_THEN]]:
-; CHECK-NEXT:    [[CALL:%.*]] = call i32 @testf(i1 [[C]])
-; CHECK-NEXT:    br label %[[RET1:.*]]
+; CHECK-NEXT:    [[CALL:%.*]] = call i32 @testf(i1 [[C]], i1 [[ARG]])
+; CHECK-NEXT:    [[RES:%.*]] = icmp eq i32 [[CALL]], 10
+; CHECK-NEXT:    br i1 [[RES]], label %[[RET1:.*]], label %[[RET2:.*]]
 ; CHECK:       [[RET1]]:
-; CHECK-NEXT:    ret i32 poison
+; CHECK-NEXT:    ret i32 99
+; CHECK:       [[RET2]]:
+; CHECK-NEXT:    ret i32 0
 ;
 entry:
   br label %if.then
 
 if.then:                                          ; preds = %entry, %if.then
-  %call = call i32 @testf(i1 %c)
+  %call = call i32 @testf(i1 %c, i1 %arg)
   %res = icmp eq i32 %call, 10
   br i1 %res, label %ret1, label %ret2
 
@@ -57,7 +61,7 @@ define i32 @main(i1 %c) {
 ; CHECK-LABEL: define i32 @main(
 ; CHECK-SAME: i1 [[C:%.*]]) {
 ; CHECK-NEXT:    [[RES:%.*]] = call i32 @test1(i1 [[C]])
-; CHECK-NEXT:    ret i32 99
+; CHECK-NEXT:    ret i32 [[RES]]
 ;
   %res = call i32 @test1(i1 %c)
   ret i32 %res
diff --git a/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll b/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
index 2336c9186636e4..b163d2c078ef69 100644
--- a/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
+++ b/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
@@ -2,8 +2,9 @@
 ; RUN: opt -passes=ipsccp < %s -S | FileCheck %s
 ; RUN: opt -passes='ipsccp,ipsccp' < %s -S | FileCheck %s
 
-define void @barney() {
-; CHECK-LABEL: define {{[^@]+}}@barney() {
+define void @barney(i1 %arg) {
+; CHECK-LABEL: define {{[^@]+}}@barney
+; CHECK-SAME: (i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB9:%.*]]
 ; CHECK:       bb6:
@@ -26,8 +27,9 @@ bb9:                                              ; preds = %bb
   ]
 }
 
-define void @blam() {
-; CHECK-LABEL: define {{[^@]+}}@blam() {
+define void @blam(i1 %arg) {
+; CHECK-LABEL: define {{[^@]+}}@blam
+; CHECK-SAME: (i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB16:%.*]]
 ; CHECK:       bb16:
@@ -59,13 +61,23 @@ bb38:                                             ; preds = %bb16
 }
 
 
-define void @hoge() {
-; CHECK-LABEL: define {{[^@]+}}@hoge() {
+define void @hoge(i1 %arg, i16 %arg2) {
+; CHECK-LABEL: define {{[^@]+}}@hoge
+; CHECK-SAME: (i1 [[ARG:%.*]], i16 [[ARG2:%.*]]) {
 ; CHECK-NEXT:  bb:
+; CHECK-NEXT:    switch i16 [[ARG2]], label [[BB1:%.*]] [
+; CHECK-NEXT:      i16 135, label [[BB2:%.*]]
+; CHECK-NEXT:      i16 66, label [[BB2]]
+; CHECK-NEXT:    ]
+; CHECK:       bb1:
+; CHECK-NEXT:    ret void
+; CHECK:       bb2:
+; CHECK-NEXT:    br label [[BB3:%.*]]
+; CHECK:       bb3:
 ; CHECK-NEXT:    unreachable
 ;
 bb:
-  switch i16 undef, label %bb1 [
+  switch i16 %arg2, label %bb1 [
   i16 135, label %bb2
   i16 66, label %bb2
   ]
@@ -89,14 +101,9 @@ bb4:                                              ; preds = %bb2, %bb2, %bb2
 
 ; Test case from PR49573. %default.bb is unfeasible. Make sure it gets replaced
 ; by an unreachable block.
-define void @pr49573_main() {
-; CHECK-LABEL: define {{[^@]+}}@pr49573_main() {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TGT:%.*]] = call i16 @pr49573_fn()
-; CHECK-NEXT:    unreachable
-;
+define void @pr49573_main(i1 %arg) {
 entry:
-  %tgt = call i16 @pr49573_fn()
+  %tgt = call i16 @pr49573_fn(i1 %arg)
   switch i16 %tgt, label %default.bb [
   i16 0, label %case.0
   i16 1, label %case.1
@@ -116,7 +123,7 @@ case.2:
   br label %next
 
 next:
-  %tgt.2 = call i16 @pr49573_fn_2()
+  %tgt.2 = call i16 @pr49573_fn_2(i1 %arg)
   switch i16 %tgt.2, label %default.bb [
   i16 0, label %case.0
   i16 2, label %case.2
@@ -124,14 +131,9 @@ next:
 }
 
 ; Make sure a new unreachable BB is created.
-define void @pr49573_main_2() {
-; CHECK-LABEL: define {{[^@]+}}@pr49573_main_2() {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TGT:%.*]] = call i16 @pr49573_fn()
-; CHECK-NEXT:    unreachable
-;
+define void @pr49573_main_2(i1 %arg) {
 entry:
-  %tgt = call i16 @pr49573_fn()
+  %tgt = call i16 @pr49573_fn(i1 %arg)
   switch i16 %tgt, label %default.bb [
   i16 0, label %case.0
   i16 1, label %case.1
@@ -151,13 +153,18 @@ case.2:
   ret void
 }
 
-define internal i16 @pr49573_fn() {
-; CHECK-LABEL: define {{[^@]+}}@pr49573_fn() {
+define internal i16 @pr49573_fn(i1 %arg) {
+; CHECK-LABEL: define {{[^@]+}}@pr49573_fn
+; CHECK-SAME: (i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG]], label [[THEN:%.*]], label [[ELSE:%.*]]
+; CHECK:       then:
+; CHECK-NEXT:    ret i16 0
+; CHECK:       else:
+; CHECK-NEXT:    ret i16 2
 ;
 entry:
-  br i1 undef, label %then, label %else
+  br i1 %arg, label %then, label %else
 
 then:
   ret i16 0
@@ -166,13 +173,18 @@ else:
   ret i16 2
 }
 
-define internal i16 @pr49573_fn_2() {
-; CHECK-LABEL: define {{[^@]+}}@pr49573_fn_2() {
+define internal i16 @pr49573_fn_2(i1 %arg) {
+; CHECK-LABEL: define {{[^@]+}}@pr49573_fn_2
+; CHECK-SAME: (i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    unreachable
+; CHECK-NEXT:    br i1 [[ARG]], label [[THEN:%.*]], label [[ELSE:%.*]]
+; CHECK:       then:
+; CHECK-NEXT:    ret i16 0
+; CHECK:       else:
+; CHECK-NEXT:    ret i16 2
 ;
 entry:
-  br i1 undef, label %then, label %else
+  br i1 %arg, label %then, label %else
 
 then:
   ret i16 0

>From b9e635636a5ae340436bfb62e9fc96d466b9c96d Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 19:56:45 -0700
Subject: [PATCH 4/9] Remove br i1 undef in SLPVectorizer directory

---
 .../SLPVectorizer/AArch64/minimum-sizes.ll    | 12 +--
 .../AArch64/reorder-fmuladd-crash.ll          | 10 +--
 .../SLPVectorizer/AArch64/trunc-insertion.ll  | 10 +--
 .../SLPVectorizer/X86/crash_7zip.ll           | 10 +--
 .../SLPVectorizer/X86/crash_bullet.ll         | 74 +++++++++----------
 .../SLPVectorizer/X86/crash_bullet3.ll        | 46 ++++++------
 .../SLPVectorizer/X86/crash_dequeue.ll        | 18 ++---
 .../SLPVectorizer/X86/crash_flop7.ll          | 18 ++---
 .../X86/crash_lencod-inseltpoison.ll          | 38 +++++-----
 .../SLPVectorizer/X86/crash_lencod.ll         | 38 +++++-----
 .../SLPVectorizer/X86/crash_mandeltext.ll     | 38 +++++-----
 .../SLPVectorizer/X86/crash_sim4b1.ll         | 62 ++++++++--------
 .../SLPVectorizer/X86/crash_smallpt.ll        | 28 +++----
 .../SLPVectorizer/X86/crash_vectorizeTree.ll  | 18 ++---
 llvm/test/Transforms/SLPVectorizer/X86/cse.ll | 10 +--
 .../X86/memory-runtime-checks.ll              | 18 ++---
 .../X86/no-scheduled-instructions.ll          |  8 +-
 .../Transforms/SLPVectorizer/X86/ordering.ll  | 10 +--
 .../Transforms/SLPVectorizer/X86/partail.ll   |  6 +-
 llvm/test/Transforms/SLPVectorizer/X86/phi.ll |  6 +-
 .../SLPVectorizer/X86/phi_overalignedtype.ll  |  6 +-
 .../Transforms/SLPVectorizer/X86/pr16571.ll   |  8 +-
 .../SLPVectorizer/X86/remark_unsupported.ll   |  6 +-
 .../SLPVectorizer/X86/reorder_repeated_ops.ll |  6 +-
 .../X86/reorder_with_reordered_users.ll       | 10 +--
 .../Transforms/SLPVectorizer/X86/resched.ll   |  6 +-
 .../X86/reuse-extracts-in-wider-vect.ll       |  6 +-
 .../X86/revectorized_rdx_crash.ll             |  6 +-
 .../X86/value-bug-inseltpoison.ll             | 10 +--
 .../Transforms/SLPVectorizer/X86/value-bug.ll | 10 +--
 .../X86/vectorize-widest-phis.ll              |  6 +-
 .../slp-umax-rdx-matcher-crash.ll             |  6 +-
 32 files changed, 282 insertions(+), 282 deletions(-)

diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/minimum-sizes.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/minimum-sizes.ll
index 920e1e64e3958f..356102ce817801 100644
--- a/llvm/test/Transforms/SLPVectorizer/AArch64/minimum-sizes.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/minimum-sizes.ll
@@ -8,10 +8,10 @@ target triple = "aarch64--linux-gnu"
 ; should not compute a smaller size for %k.13 since it is in a use-def cycle
 ; and cannot be demoted.
 ;
-define fastcc void @PR26364() {
+define fastcc void @PR26364(i1 %arg) {
 ; CHECK-LABEL: @PR26364(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END11:%.*]], label [[FOR_COND4:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END11:%.*]], label [[FOR_COND4:%.*]]
 ; CHECK:       for.cond4:
 ; CHECK-NEXT:    [[K_13:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[K_3:%.*]], [[FOR_COND4]] ]
 ; CHECK-NEXT:    [[E_02:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ 0, [[FOR_COND4]] ]
@@ -22,7 +22,7 @@ define fastcc void @PR26364() {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %for.end11, label %for.cond4
+  br i1 %arg, label %for.end11, label %for.cond4
 
 for.cond4:
   %k.13 = phi i32 [ undef, %entry ], [ %k.3, %for.cond4 ]
@@ -39,10 +39,10 @@ for.end11:
 ; every root in the vectorizable tree when computing minimum sizes since one
 ; root may require fewer bits than another.
 ;
-define void @PR26629(ptr %c) {
+define void @PR26629(ptr %c, i1 %arg) {
 ; CHECK-LABEL: @PR26629(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[FOR_PH:%.*]], label [[FOR_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_PH:%.*]], label [[FOR_END:%.*]]
 ; CHECK:       for.ph:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[C:%.*]], align 4
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
@@ -59,7 +59,7 @@ define void @PR26629(ptr %c) {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %for.ph, label %for.end
+  br i1 %arg, label %for.ph, label %for.end
 
 for.ph:
   %0 = load i32, ptr %c, align 4
diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/reorder-fmuladd-crash.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/reorder-fmuladd-crash.ll
index dc05967af15295..f5e904467baa7f 100644
--- a/llvm/test/Transforms/SLPVectorizer/AArch64/reorder-fmuladd-crash.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/reorder-fmuladd-crash.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=aarch64-w32-windows-gnu | FileCheck %s
 
-define i32 @foo(i32 %v1, double %v2) {
+define i32 @foo(i32 %v1, double %v2, i1 %arg, i32 %arg2) {
 ; CHECK-LABEL: @foo(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x i32> <i32 poison, i32 undef>, i32 [[V1:%.*]], i32 0
@@ -15,7 +15,7 @@ define i32 @foo(i32 %v1, double %v2) {
 ; CHECK:       if.end:
 ; CHECK-NEXT:    br label [[FOR_COND15:%.*]]
 ; CHECK:       for.end39:
-; CHECK-NEXT:    switch i32 undef, label [[DO_BODY:%.*]] [
+; CHECK-NEXT:    switch i32 %arg2, label [[DO_BODY:%.*]] [
 ; CHECK-NEXT:      i32 0, label [[SW_BB:%.*]]
 ; CHECK-NEXT:      i32 1, label [[SW_BB195:%.*]]
 ; CHECK-NEXT:    ]
@@ -39,7 +39,7 @@ define i32 @foo(i32 %v1, double %v2) {
 ; CHECK:       if.end.1:
 ; CHECK-NEXT:    br label [[FOR_COND15_1:%.*]]
 ; CHECK:       for.cond15.1:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END39:%.*]], label [[FOR_COND15_PREHEADER]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END39:%.*]], label [[FOR_COND15_PREHEADER]]
 ;
 entry:
   %conv = sitofp i32 undef to double
@@ -56,7 +56,7 @@ if.end:                                           ; preds = %for.cond15.preheade
   br label %for.cond15
 
 for.end39:                                        ; preds = %for.cond15.1
-  switch i32 undef, label %do.body [
+  switch i32 %arg2, label %do.body [
   i32 0, label %sw.bb
   i32 1, label %sw.bb195
   ]
@@ -99,7 +99,7 @@ if.end.1:                                         ; preds = %for.cond15
   br label %for.cond15.1
 
 for.cond15.1:                                     ; preds = %if.end.1
-  br i1 undef, label %for.end39, label %for.cond15.preheader
+  br i1 %arg, label %for.end39, label %for.cond15.preheader
 }
 
 declare double @llvm.fmuladd.f64(double, double, double)
diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/trunc-insertion.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/trunc-insertion.ll
index 9910090d43eae9..82761b458efcfc 100644
--- a/llvm/test/Transforms/SLPVectorizer/AArch64/trunc-insertion.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/trunc-insertion.ll
@@ -3,13 +3,13 @@
 target triple = "aarch64-unknown-linux-gnu"
 @d = internal unnamed_addr global i32 5, align 4
 
-define dso_local void @l() local_unnamed_addr {
+define dso_local void @l(i1 %arg) local_unnamed_addr {
 ; CHECK-LABEL: @l(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB1:%.*]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    [[TMP0:%.*]] = phi <2 x i16> [ undef, [[BB:%.*]] ], [ [[TMP9:%.*]], [[BB25:%.*]] ]
-; CHECK-NEXT:    br i1 undef, label [[BB3:%.*]], label [[BB11:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB3:%.*]], label [[BB11:%.*]]
 ; CHECK:       bb3:
 ; CHECK-NEXT:    [[I4:%.*]] = zext i1 undef to i32
 ; CHECK-NEXT:    [[TMP1:%.*]] = xor <2 x i16> [[TMP0]], undef
@@ -34,7 +34,7 @@ define dso_local void @l() local_unnamed_addr {
 ; CHECK-NEXT:    [[TMP13:%.*]] = zext i1 [[TMP12]] to i32
 ; CHECK-NEXT:    [[I32:%.*]] = and i32 [[I31]], [[TMP13]]
 ; CHECK-NEXT:    [[I33:%.*]] = and i32 [[I32]], [[I28]]
-; CHECK-NEXT:    br i1 undef, label [[BB34:%.*]], label [[BB1]]
+; CHECK-NEXT:    br i1 %arg, label [[BB34:%.*]], label [[BB1]]
 ; CHECK:       bb34:
 ; CHECK-NEXT:    [[I35:%.*]] = phi i32 [ [[I33]], [[BB25]] ]
 ; CHECK-NEXT:    br label [[BB36:%.*]]
@@ -48,7 +48,7 @@ bb:
 bb1:                                              ; preds = %bb25, %bb
   %i = phi i16 [ undef, %bb ], [ %i29, %bb25 ]
   %i2 = phi i16 [ undef, %bb ], [ %i30, %bb25 ]
-  br i1 undef, label %bb3, label %bb11
+  br i1 %arg, label %bb3, label %bb11
 
 bb3:                                              ; preds = %bb1
   %i4 = zext i1 undef to i32
@@ -85,7 +85,7 @@ bb25:                                             ; preds = %bb11, %bb3
   %i31 = and i32 undef, %i26
   %i32 = and i32 %i31, %i27
   %i33 = and i32 %i32, %i28
-  br i1 undef, label %bb34, label %bb1
+  br i1 %arg, label %bb34, label %bb1
 
 bb34:                                             ; preds = %bb25
   %i35 = phi i32 [ %i33, %bb25 ]
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
index 607d7f78887842..c029781142af33 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
 %struct.CLzmaDec.1.28.55.82.103.124.145.166.181.196.229.259.334 = type { %struct._CLzmaProps.0.27.54.81.102.123.144.165.180.195.228.258.333, ptr, ptr, ptr, i32, i32, i64, i64, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32, [20 x i8] }
 %struct._CLzmaProps.0.27.54.81.102.123.144.165.180.195.228.258.333 = type { i32, i32, i32, i32 }
 
-define fastcc void @LzmaDec_DecodeReal2(ptr %p) {
+define fastcc void @LzmaDec_DecodeReal2(ptr %p, i1 %arg) {
 ; CHECK-LABEL: @LzmaDec_DecodeReal2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[RANGE20_I:%.*]] = getelementptr inbounds [[STRUCT_CLZMADEC_1_28_55_82_103_124_145_166_181_196_229_259_334:%.*]], ptr [[P:%.*]], i64 0, i32 4
@@ -15,13 +15,13 @@ define fastcc void @LzmaDec_DecodeReal2(ptr %p) {
 ; CHECK:       do.body66.i:
 ; CHECK-NEXT:    [[TMP0:%.*]] = phi <2 x i32> [ [[TMP3:%.*]], [[DO_COND_I:%.*]] ], [ undef, [[ENTRY:%.*]] ]
 ; CHECK-NEXT:    [[TMP1:%.*]] = select <2 x i1> undef, <2 x i32> undef, <2 x i32> [[TMP0]]
-; CHECK-NEXT:    br i1 undef, label [[DO_COND_I]], label [[IF_ELSE_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[DO_COND_I]], label [[IF_ELSE_I:%.*]]
 ; CHECK:       if.else.i:
 ; CHECK-NEXT:    [[TMP2:%.*]] = sub <2 x i32> [[TMP1]], undef
 ; CHECK-NEXT:    br label [[DO_COND_I]]
 ; CHECK:       do.cond.i:
 ; CHECK-NEXT:    [[TMP3]] = phi <2 x i32> [ [[TMP2]], [[IF_ELSE_I]] ], [ [[TMP1]], [[DO_BODY66_I]] ]
-; CHECK-NEXT:    br i1 undef, label [[DO_BODY66_I]], label [[DO_END1006_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[DO_BODY66_I]], label [[DO_END1006_I:%.*]]
 ; CHECK:       do.end1006.i:
 ; CHECK-NEXT:    [[TMP4:%.*]] = select <2 x i1> undef, <2 x i32> undef, <2 x i32> [[TMP3]]
 ; CHECK-NEXT:    store <2 x i32> [[TMP4]], ptr [[RANGE20_I]], align 4
@@ -37,7 +37,7 @@ do.body66.i:                                      ; preds = %do.cond.i, %entry
   %code.2.i = phi i32 [ %code.4.i, %do.cond.i ], [ undef, %entry ]
   %.range.2.i = select i1 undef, i32 undef, i32 %range.2.i
   %.code.2.i = select i1 undef, i32 undef, i32 %code.2.i
-  br i1 undef, label %do.cond.i, label %if.else.i
+  br i1 %arg, label %do.cond.i, label %if.else.i
 
 if.else.i:                                        ; preds = %do.body66.i
   %sub91.i = sub i32 %.range.2.i, undef
@@ -47,7 +47,7 @@ if.else.i:                                        ; preds = %do.body66.i
 do.cond.i:                                        ; preds = %if.else.i, %do.body66.i
   %range.4.i = phi i32 [ %sub91.i, %if.else.i ], [ undef, %do.body66.i ]
   %code.4.i = phi i32 [ %sub92.i, %if.else.i ], [ %.code.2.i, %do.body66.i ]
-  br i1 undef, label %do.body66.i, label %do.end1006.i
+  br i1 %arg, label %do.body66.i, label %do.end1006.i
 
 do.end1006.i:                                     ; preds = %do.cond.i
   %.range.4.i = select i1 undef, i32 undef, i32 %range.4.i
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet.ll
index f1f83c0663099a..291edbbc925bdb 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet.ll
@@ -6,17 +6,17 @@ target triple = "x86_64-apple-macosx10.8.0"
 
 %"struct.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960" = type { i32, i32 }
 
-define void @_ZN23btGeneric6DofConstraint8getInfo1EPN17btTypedConstraint17btConstraintInfo1E(ptr nocapture %info) {
+define void @_ZN23btGeneric6DofConstraint8getInfo1EPN17btTypedConstraint17btConstraintInfo1E(ptr nocapture %info, i1 %arg) {
 ; CHECK-LABEL: @_ZN23btGeneric6DofConstraint8getInfo1EPN17btTypedConstraint17btConstraintInfo1E(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    ret void
 ; CHECK:       if.else:
 ; CHECK-NEXT:    [[NUB5:%.*]] = getelementptr inbounds %"struct.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960", ptr [[INFO:%.*]], i64 0, i32 1
-; CHECK-NEXT:    br i1 undef, label [[LAND_LHS_TRUE_I_1:%.*]], label [[IF_THEN7_1:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LAND_LHS_TRUE_I_1:%.*]], label [[IF_THEN7_1:%.*]]
 ; CHECK:       land.lhs.true.i.1:
-; CHECK-NEXT:    br i1 undef, label [[FOR_INC_1:%.*]], label [[IF_THEN7_1]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_INC_1:%.*]], label [[IF_THEN7_1]]
 ; CHECK:       if.then7.1:
 ; CHECK-NEXT:    store <2 x i32> <i32 1, i32 5>, ptr [[INFO]], align 4
 ; CHECK-NEXT:    br label [[FOR_INC_1]]
@@ -30,17 +30,17 @@ define void @_ZN23btGeneric6DofConstraint8getInfo1EPN17btTypedConstraint17btCons
 ; CHECK-NEXT:    unreachable
 ;
 entry:
-  br i1 undef, label %if.else, label %if.then
+  br i1 %arg, label %if.else, label %if.then
 
 if.then:                                          ; preds = %entry
   ret void
 
 if.else:                                          ; preds = %entry
   %nub5 = getelementptr inbounds %"struct.btTypedConstraint::btConstraintInfo1.17.157.357.417.477.960", ptr %info, i64 0, i32 1
-  br i1 undef, label %land.lhs.true.i.1, label %if.then7.1
+  br i1 %arg, label %land.lhs.true.i.1, label %if.then7.1
 
 land.lhs.true.i.1:                                ; preds = %if.else
-  br i1 undef, label %for.inc.1, label %if.then7.1
+  br i1 %arg, label %for.inc.1, label %if.then7.1
 
 if.then7.1:                                       ; preds = %land.lhs.true.i.1, %if.else
   %inc.1 = add nsw i32 0, 1
@@ -63,7 +63,7 @@ for.inc.1:                                        ; preds = %if.then7.1, %land.l
 %class.btVector3.5.30.65.90.115.140.175.185.260.280.330 = type { [4 x float] }
 %class.btVector4.7.32.67.92.117.142.177.187.262.282.331 = type { %class.btVector3.5.30.65.90.115.140.175.185.260.280.330 }
 
-define void @_ZN30GIM_TRIANGLE_CALCULATION_CACHE18triangle_collisionERK9btVector3S2_S2_fS2_S2_S2_fR25GIM_TRIANGLE_CONTACT_DATA(ptr %this) {
+define void @_ZN30GIM_TRIANGLE_CALCULATION_CACHE18triangle_collisionERK9btVector3S2_S2_fS2_S2_S2_fR25GIM_TRIANGLE_CONTACT_DATA(ptr %this, i1 %arg) {
 ; CHECK-LABEL: @_ZN30GIM_TRIANGLE_CALCULATION_CACHE18triangle_collisionERK9btVector3S2_S2_fS2_S2_S2_fR25GIM_TRIANGLE_CONTACT_DATA(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[ARRAYIDX26:%.*]] = getelementptr inbounds [[CLASS_GIM_TRIANGLE_CALCULATION_CACHE_9_34_69_94_119_144_179_189_264_284_332:%.*]], ptr [[THIS:%.*]], i64 0, i32 2, i64 0, i32 0, i64 1
@@ -76,9 +76,9 @@ define void @_ZN30GIM_TRIANGLE_CALCULATION_CACHE18triangle_collisionERK9btVector
 ; CHECK-NEXT:    store float [[TMP4]], ptr undef, align 4
 ; CHECK-NEXT:    [[TMP5:%.*]] = fsub <2 x float> [[TMP2]], [[TMP3]]
 ; CHECK-NEXT:    store <2 x float> [[TMP5]], ptr [[ARRAYIDX26]], align 4
-; CHECK-NEXT:    br i1 undef, label [[IF_ELSE1609:%.*]], label [[IF_THEN1595:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_ELSE1609:%.*]], label [[IF_THEN1595:%.*]]
 ; CHECK:       if.then1595:
-; CHECK-NEXT:    br i1 undef, label [[RETURN:%.*]], label [[FOR_BODY_LR_PH_I_I1702:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN:%.*]], label [[FOR_BODY_LR_PH_I_I1702:%.*]]
 ; CHECK:       for.body.lr.ph.i.i1702:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       if.else1609:
@@ -99,10 +99,10 @@ entry:
   %sub639 = fsub float %add626, undef
   %sub652 = fsub float %add626, %sub639
   store float %sub652, ptr %arrayidx36, align 4
-  br i1 undef, label %if.else1609, label %if.then1595
+  br i1 %arg, label %if.else1609, label %if.then1595
 
 if.then1595:                                      ; preds = %entry
-  br i1 undef, label %return, label %for.body.lr.ph.i.i1702
+  br i1 %arg, label %return, label %for.body.lr.ph.i.i1702
 
 for.body.lr.ph.i.i1702:                           ; preds = %if.then1595
   unreachable
@@ -114,34 +114,34 @@ return:                                           ; preds = %if.then1595
   ret void
 }
 
-define void @_Z8dBoxBox2RK9btVector3PKfS1_S1_S3_S1_RS_PfPiiP12dContactGeomiRN36btDiscreteCollisionDetectorInterface6ResultE() {
+define void @_Z8dBoxBox2RK9btVector3PKfS1_S1_S3_S1_RS_PfPiiP12dContactGeomiRN36btDiscreteCollisionDetectorInterface6ResultE(i1 %arg) {
 ; CHECK-LABEL: @_Z8dBoxBox2RK9btVector3PKfS1_S1_S3_S1_RS_PfPiiP12dContactGeomiRN36btDiscreteCollisionDetectorInterface6ResultE(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[RETURN:%.*]], label [[IF_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN:%.*]], label [[IF_END:%.*]]
 ; CHECK:       if.end:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END111:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END111:%.*]]
 ; CHECK:       if.end111:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END136:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END136:%.*]]
 ; CHECK:       if.end136:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END162:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END162:%.*]]
 ; CHECK:       if.end162:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END189:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END189:%.*]]
 ; CHECK:       if.end189:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END216:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END216:%.*]]
 ; CHECK:       if.end216:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN218:%.*]], label [[IF_END225:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN218:%.*]], label [[IF_END225:%.*]]
 ; CHECK:       if.then218:
 ; CHECK-NEXT:    br label [[IF_END225]]
 ; CHECK:       if.end225:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END248:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END248:%.*]]
 ; CHECK:       if.end248:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END304:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END304:%.*]]
 ; CHECK:       if.end304:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END361:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END361:%.*]]
 ; CHECK:       if.end361:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN370:%.*]], label [[IF_END395:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN370:%.*]], label [[IF_END395:%.*]]
 ; CHECK:       if.then370:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN374:%.*]], label [[IF_END395]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN374:%.*]], label [[IF_END395]]
 ; CHECK:       if.then374:
 ; CHECK-NEXT:    br label [[IF_END395]]
 ; CHECK:       if.end395:
@@ -152,47 +152,47 @@ define void @_Z8dBoxBox2RK9btVector3PKfS1_S1_S3_S1_RS_PfPiiP12dContactGeomiRN36b
 entry:
   %add8.i2343 = fadd float undef, undef
   %add8.i2381 = fadd float undef, undef
-  br i1 undef, label %return, label %if.end
+  br i1 %arg, label %return, label %if.end
 
 if.end:                                           ; preds = %entry
-  br i1 undef, label %return, label %if.end111
+  br i1 %arg, label %return, label %if.end111
 
 if.end111:                                        ; preds = %if.end
-  br i1 undef, label %return, label %if.end136
+  br i1 %arg, label %return, label %if.end136
 
 if.end136:                                        ; preds = %if.end111
-  br i1 undef, label %return, label %if.end162
+  br i1 %arg, label %return, label %if.end162
 
 if.end162:                                        ; preds = %if.end136
-  br i1 undef, label %return, label %if.end189
+  br i1 %arg, label %return, label %if.end189
 
 if.end189:                                        ; preds = %if.end162
-  br i1 undef, label %return, label %if.end216
+  br i1 %arg, label %return, label %if.end216
 
 if.end216:                                        ; preds = %if.end189
-  br i1 undef, label %if.then218, label %if.end225
+  br i1 %arg, label %if.then218, label %if.end225
 
 if.then218:                                       ; preds = %if.end216
   br label %if.end225
 
 if.end225:                                        ; preds = %if.then218, %if.end216
-  br i1 undef, label %return, label %if.end248
+  br i1 %arg, label %return, label %if.end248
 
 if.end248:                                        ; preds = %if.end225
-  br i1 undef, label %return, label %if.end304
+  br i1 %arg, label %return, label %if.end304
 
 if.end304:                                        ; preds = %if.end248
   %mul341 = fmul float undef, %add8.i2343
   %mul344 = fmul float undef, %add8.i2381
   %sub345 = fsub float %mul341, %mul344
-  br i1 undef, label %return, label %if.end361
+  br i1 %arg, label %return, label %if.end361
 
 if.end361:                                        ; preds = %if.end304
   %mul364 = fmul float %add8.i2381, %add8.i2381
-  br i1 undef, label %if.then370, label %if.end395
+  br i1 %arg, label %if.then370, label %if.end395
 
 if.then370:                                       ; preds = %if.end361
-  br i1 undef, label %if.then374, label %if.end395
+  br i1 %arg, label %if.then374, label %if.end395
 
 if.then374:                                       ; preds = %if.then370
   %cmp392 = fcmp olt float %sub345, 0.000000e+00
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll
index 925b348cdeec1f..55e691b39d78c7 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll
@@ -7,36 +7,36 @@ target triple = "x86_64-apple-macosx10.8.0"
 %class.btVector3.23.221.463.485.507.573.595.683.727.749.815.837.991.1585.1607.1629.1651.1849.2047.2069.2091.2113 = type { [4 x float] }
 
 ; Function Attrs: ssp uwtable
-define void @_ZN11HullLibrary15CleanupVerticesEjPK9btVector3jRjPS0_fRS0_(ptr %vertices) #0 align 2 {
+define void @_ZN11HullLibrary15CleanupVerticesEjPK9btVector3jRjPS0_fRS0_(ptr %vertices, i1 %arg) #0 align 2 {
 ; CHECK-LABEL: @_ZN11HullLibrary15CleanupVerticesEjPK9btVector3jRjPS0_fRS0_(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[RETURN:%.*]], label [[IF_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN:%.*]], label [[IF_END:%.*]]
 ; CHECK:       if.end:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN17_1:%.*]], label [[IF_END22_1:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN17_1:%.*]], label [[IF_END22_1:%.*]]
 ; CHECK:       for.end36:
 ; CHECK-NEXT:    br label [[FOR_BODY144:%.*]]
 ; CHECK:       for.body144:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END227:%.*]], label [[FOR_BODY144]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END227:%.*]], label [[FOR_BODY144]]
 ; CHECK:       for.end227:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END271:%.*]], label [[FOR_BODY233:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END271:%.*]], label [[FOR_BODY233:%.*]]
 ; CHECK:       for.body233:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY233]], label [[FOR_END271]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY233]], label [[FOR_END271]]
 ; CHECK:       for.end271:
 ; CHECK-NEXT:    [[TMP0:%.*]] = phi <2 x float> [ splat (float 0x47EFFFFFE0000000), [[FOR_END227]] ], [ undef, [[FOR_BODY233]] ]
 ; CHECK-NEXT:    [[TMP1:%.*]] = fsub <2 x float> undef, [[TMP0]]
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN291:%.*]], label [[RETURN]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN291:%.*]], label [[RETURN]]
 ; CHECK:       if.then291:
 ; CHECK-NEXT:    [[TMP2:%.*]] = fmul <2 x float> [[TMP1]], splat (float 5.000000e-01)
 ; CHECK-NEXT:    [[TMP3:%.*]] = fadd <2 x float> [[TMP0]], [[TMP2]]
-; CHECK-NEXT:    br i1 undef, label [[IF_END332:%.*]], label [[IF_ELSE319:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END332:%.*]], label [[IF_ELSE319:%.*]]
 ; CHECK:       if.else319:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN325:%.*]], label [[IF_END327:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN325:%.*]], label [[IF_END327:%.*]]
 ; CHECK:       if.then325:
 ; CHECK-NEXT:    br label [[IF_END327]]
 ; CHECK:       if.end327:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN329:%.*]], label [[IF_END332]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN329:%.*]], label [[IF_END332]]
 ; CHECK:       if.then329:
 ; CHECK-NEXT:    br label [[IF_END332]]
 ; CHECK:       if.end332:
@@ -49,55 +49,55 @@ define void @_ZN11HullLibrary15CleanupVerticesEjPK9btVector3jRjPS0_fRS0_(ptr %ve
 ; CHECK:       if.then17.1:
 ; CHECK-NEXT:    br label [[IF_END22_1]]
 ; CHECK:       if.end22.1:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN17_2:%.*]], label [[IF_END22_2:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN17_2:%.*]], label [[IF_END22_2:%.*]]
 ; CHECK:       if.then17.2:
 ; CHECK-NEXT:    br label [[IF_END22_2]]
 ; CHECK:       if.end22.2:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END36:%.*]], label [[FOR_BODY]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END36:%.*]], label [[FOR_BODY]]
 ;
 entry:
-  br i1 undef, label %return, label %if.end
+  br i1 %arg, label %return, label %if.end
 
 if.end:                                           ; preds = %entry
   br label %for.body
 
 for.body:                                         ; preds = %if.end22.2, %if.end
-  br i1 undef, label %if.then17.1, label %if.end22.1
+  br i1 %arg, label %if.then17.1, label %if.end22.1
 
 for.end36:                                        ; preds = %if.end22.2
   br label %for.body144
 
 for.body144:                                      ; preds = %for.body144, %for.end36
-  br i1 undef, label %for.end227, label %for.body144
+  br i1 %arg, label %for.end227, label %for.body144
 
 for.end227:                                       ; preds = %for.body144
-  br i1 undef, label %for.end271, label %for.body233
+  br i1 %arg, label %for.end271, label %for.body233
 
 for.body233:                                      ; preds = %for.body233, %for.end227
-  br i1 undef, label %for.body233, label %for.end271
+  br i1 %arg, label %for.body233, label %for.end271
 
 for.end271:                                       ; preds = %for.body233, %for.end227
   %0 = phi float [ 0x47EFFFFFE0000000, %for.end227 ], [ undef, %for.body233 ]
   %1 = phi float [ 0x47EFFFFFE0000000, %for.end227 ], [ undef, %for.body233 ]
   %sub275 = fsub float undef, %1
   %sub279 = fsub float undef, %0
-  br i1 undef, label %if.then291, label %return
+  br i1 %arg, label %if.then291, label %return
 
 if.then291:                                       ; preds = %for.end271
   %mul292 = fmul float %sub275, 5.000000e-01
   %add294 = fadd float %1, %mul292
   %mul295 = fmul float %sub279, 5.000000e-01
   %add297 = fadd float %0, %mul295
-  br i1 undef, label %if.end332, label %if.else319
+  br i1 %arg, label %if.end332, label %if.else319
 
 if.else319:                                       ; preds = %if.then291
-  br i1 undef, label %if.then325, label %if.end327
+  br i1 %arg, label %if.then325, label %if.end327
 
 if.then325:                                       ; preds = %if.else319
   br label %if.end327
 
 if.end327:                                        ; preds = %if.then325, %if.else319
-  br i1 undef, label %if.then329, label %if.end332
+  br i1 %arg, label %if.then329, label %if.end332
 
 if.then329:                                       ; preds = %if.end327
   br label %if.end332
@@ -119,13 +119,13 @@ if.then17.1:                                      ; preds = %for.body
   br label %if.end22.1
 
 if.end22.1:                                       ; preds = %if.then17.1, %for.body
-  br i1 undef, label %if.then17.2, label %if.end22.2
+  br i1 %arg, label %if.then17.2, label %if.end22.2
 
 if.then17.2:                                      ; preds = %if.end22.1
   br label %if.end22.2
 
 if.end22.2:                                       ; preds = %if.then17.2, %if.end22.1
-  br i1 undef, label %for.end36, label %for.body
+  br i1 %arg, label %for.end36, label %for.body
 }
 
 attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll
index 4de16a5d57793d..faf4496ce27225 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_dequeue.ll
@@ -6,23 +6,23 @@ target triple = "x86_64-apple-macosx10.8.0"
 %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731" = type { ptr, ptr, ptr, ptr }
 
 ; Function Attrs: nounwind ssp uwtable
-define void @_ZSt6uniqueISt15_Deque_iteratorIdRdPdEET_S4_S4_(ptr %__first, ptr nocapture %__last) {
+define void @_ZSt6uniqueISt15_Deque_iteratorIdRdPdEET_S4_S4_(ptr %__first, ptr nocapture %__last, i1 %arg) {
 ; CHECK-LABEL: @_ZSt6uniqueISt15_Deque_iteratorIdRdPdEET_S4_S4_(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load ptr, ptr [[__FIRST:%.*]], align 8
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x ptr>, ptr [[__LAST:%.*]], align 8
 ; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <2 x ptr> [[TMP1]], ptr [[TMP0]], i32 0
-; CHECK-NEXT:    br i1 undef, label [[_ZST13ADJACENT_FINDIST15_DEQUE_ITERATORIDRDPDEET_S4_S4__EXIT:%.*]], label [[WHILE_COND_I_PREHEADER:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[_ZST13ADJACENT_FINDIST15_DEQUE_ITERATORIDRDPDEET_S4_S4__EXIT:%.*]], label [[WHILE_COND_I_PREHEADER:%.*]]
 ; CHECK:       while.cond.i.preheader:
 ; CHECK-NEXT:    br label [[WHILE_COND_I:%.*]]
 ; CHECK:       while.cond.i:
-; CHECK-NEXT:    br i1 undef, label [[_ZST13ADJACENT_FINDIST15_DEQUE_ITERATORIDRDPDEET_S4_S4__EXIT]], label [[WHILE_BODY_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[_ZST13ADJACENT_FINDIST15_DEQUE_ITERATORIDRDPDEET_S4_S4__EXIT]], label [[WHILE_BODY_I:%.*]]
 ; CHECK:       while.body.i:
-; CHECK-NEXT:    br i1 undef, label [[_ZST13ADJACENT_FINDIST15_DEQUE_ITERATORIDRDPDEET_S4_S4__EXIT]], label [[WHILE_COND_I]]
+; CHECK-NEXT:    br i1 %arg, label [[_ZST13ADJACENT_FINDIST15_DEQUE_ITERATORIDRDPDEET_S4_S4__EXIT]], label [[WHILE_COND_I]]
 ; CHECK:       _ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit:
 ; CHECK-NEXT:    [[TMP3:%.*]] = phi <2 x ptr> [ [[TMP2]], [[ENTRY:%.*]] ], [ [[TMP1]], [[WHILE_COND_I]] ], [ undef, [[WHILE_BODY_I]] ]
 ; CHECK-NEXT:    store <2 x ptr> [[TMP3]], ptr [[__FIRST]], align 8
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN_I55:%.*]], label [[WHILE_COND:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN_I55:%.*]], label [[WHILE_COND:%.*]]
 ; CHECK:       if.then.i55:
 ; CHECK-NEXT:    br label [[WHILE_COND]]
 ; CHECK:       while.cond:
@@ -34,23 +34,23 @@ entry:
   %1 = load ptr, ptr %__last, align 8
   %_M_first3.i.i83 = getelementptr inbounds %"struct.std::_Deque_iterator.4.157.174.208.259.276.344.731", ptr %__last, i64 0, i32 1
   %2 = load ptr, ptr %_M_first3.i.i83, align 8
-  br i1 undef, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.cond.i.preheader
+  br i1 %arg, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.cond.i.preheader
 
 while.cond.i.preheader:                           ; preds = %entry
   br label %while.cond.i
 
 while.cond.i:                                     ; preds = %while.body.i, %while.cond.i.preheader
-  br i1 undef, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.body.i
+  br i1 %arg, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.body.i
 
 while.body.i:                                     ; preds = %while.cond.i
-  br i1 undef, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.cond.i
+  br i1 %arg, label %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit, label %while.cond.i
 
 _ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit: ; preds = %while.body.i, %while.cond.i, %entry
   %3 = phi ptr [ %2, %entry ], [ %2, %while.cond.i ], [ undef, %while.body.i ]
   %4 = phi ptr [ %0, %entry ], [ %1, %while.cond.i ], [ undef, %while.body.i ]
   store ptr %4, ptr %__first, align 8
   store ptr %3, ptr %_M_first3.i.i, align 8
-  br i1 undef, label %if.then.i55, label %while.cond
+  br i1 %arg, label %if.then.i55, label %while.cond
 
 if.then.i55:                                      ; preds = %_ZSt13adjacent_findISt15_Deque_iteratorIdRdPdEET_S4_S4_.exit
   br label %while.cond
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_flop7.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_flop7.ll
index 371b06869841b2..fc1bd856da9c3f 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_flop7.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_flop7.ll
@@ -5,20 +5,20 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
 target triple = "x86_64-apple-macosx10.8.0"
 
 ; Function Attrs: nounwind ssp uwtable
-define void @main() #0 {
+define void @main(i1 %arg) #0 {
 ; CHECK-LABEL: @main(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
 ; CHECK:       while.body:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       while.end:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END80:%.*]], label [[FOR_BODY75_LR_PH:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END80:%.*]], label [[FOR_BODY75_LR_PH:%.*]]
 ; CHECK:       for.body75.lr.ph:
 ; CHECK-NEXT:    br label [[FOR_BODY75:%.*]]
 ; CHECK:       for.body75:
 ; CHECK-NEXT:    br label [[FOR_BODY75]]
 ; CHECK:       for.end80:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END300:%.*]], label [[FOR_BODY267_LR_PH:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END300:%.*]], label [[FOR_BODY267_LR_PH:%.*]]
 ; CHECK:       for.body267.lr.ph:
 ; CHECK-NEXT:    br label [[FOR_BODY267:%.*]]
 ; CHECK:       for.body267:
@@ -32,18 +32,18 @@ define void @main() #0 {
 ; CHECK-NEXT:    [[ADD295:%.*]] = fadd double undef, [[MUL294]]
 ; CHECK-NEXT:    [[DIV296:%.*]] = fdiv double [[MUL283]], [[ADD295]]
 ; CHECK-NEXT:    [[ADD297]] = fadd double [[S_71010]], [[DIV296]]
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY267]], label [[FOR_END300]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY267]], label [[FOR_END300]]
 ; CHECK:       for.end300:
 ; CHECK-NEXT:    unreachable
 ;
 entry:
-  br i1 undef, label %while.body, label %while.end
+  br i1 %arg, label %while.body, label %while.end
 
 while.body:                                       ; preds = %entry
   unreachable
 
 while.end:                                        ; preds = %entry
-  br i1 undef, label %for.end80, label %for.body75.lr.ph
+  br i1 %arg, label %for.end80, label %for.body75.lr.ph
 
 for.body75.lr.ph:                                 ; preds = %while.end
   br label %for.body75
@@ -52,7 +52,7 @@ for.body75:                                       ; preds = %for.body75, %for.bo
   br label %for.body75
 
 for.end80:                                        ; preds = %while.end
-  br i1 undef, label %for.end300, label %for.body267.lr.ph
+  br i1 %arg, label %for.end300, label %for.body267.lr.ph
 
 for.body267.lr.ph:                                ; preds = %for.end80
   br label %for.body267
@@ -68,7 +68,7 @@ for.body267:                                      ; preds = %for.body267, %for.b
   %add295 = fadd double undef, %mul294
   %div296 = fdiv double %mul283, %add295
   %add297 = fadd double %s.71010, %div296
-  br i1 undef, label %for.body267, label %for.end300
+  br i1 %arg, label %for.body267, label %for.end300
 
 for.end300:                                       ; preds = %for.body267, %for.end80
   unreachable
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod-inseltpoison.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod-inseltpoison.ll
index 6ac588524f8452..d516126d8412d9 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod-inseltpoison.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod-inseltpoison.ll
@@ -5,34 +5,34 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
 target triple = "x86_64-apple-macosx10.8.0"
 
 ; Function Attrs: nounwind ssp uwtable
-define void @RCModelEstimator() {
+define void @RCModelEstimator(i1 %arg) {
 ; CHECK-LABEL: @RCModelEstimator(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END_THREAD:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END_THREAD:%.*]]
 ; CHECK:       for.end.thread:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       for.body.lr.ph:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END]], label [[FOR_BODY]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END]], label [[FOR_BODY]]
 ; CHECK:       for.end:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY3:%.*]], label [[IF_END103:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY3:%.*]], label [[IF_END103:%.*]]
 ; CHECK:       for.cond14.preheader:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY16_LR_PH:%.*]], label [[IF_END103]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY16_LR_PH:%.*]], label [[IF_END103]]
 ; CHECK:       for.body16.lr.ph:
 ; CHECK-NEXT:    br label [[FOR_BODY16:%.*]]
 ; CHECK:       for.body3:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN7:%.*]], label [[FOR_INC11:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN7:%.*]], label [[FOR_INC11:%.*]]
 ; CHECK:       if.then7:
 ; CHECK-NEXT:    br label [[FOR_INC11]]
 ; CHECK:       for.inc11:
 ; CHECK-NEXT:    br i1 false, label [[FOR_COND14_PREHEADER:%.*]], label [[FOR_BODY3]]
 ; CHECK:       for.body16:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END39:%.*]], label [[FOR_BODY16]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END39:%.*]], label [[FOR_BODY16]]
 ; CHECK:       for.end39:
-; CHECK-NEXT:    br i1 undef, label [[IF_END103]], label [[FOR_COND45_PREHEADER:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END103]], label [[FOR_COND45_PREHEADER:%.*]]
 ; CHECK:       for.cond45.preheader:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN88:%.*]], label [[IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN88:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then88:
 ; CHECK-NEXT:    br label [[IF_END103]]
 ; CHECK:       if.else:
@@ -41,28 +41,28 @@ define void @RCModelEstimator() {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %for.body.lr.ph, label %for.end.thread
+  br i1 %arg, label %for.body.lr.ph, label %for.end.thread
 
 for.end.thread:                                   ; preds = %entry
   unreachable
 
 for.body.lr.ph:                                   ; preds = %entry
-  br i1 undef, label %for.end, label %for.body
+  br i1 %arg, label %for.end, label %for.body
 
 for.body:                                         ; preds = %for.body, %for.body.lr.ph
-  br i1 undef, label %for.end, label %for.body
+  br i1 %arg, label %for.end, label %for.body
 
 for.end:                                          ; preds = %for.body, %for.body.lr.ph
-  br i1 undef, label %for.body3, label %if.end103
+  br i1 %arg, label %for.body3, label %if.end103
 
 for.cond14.preheader:                             ; preds = %for.inc11
-  br i1 undef, label %for.body16.lr.ph, label %if.end103
+  br i1 %arg, label %for.body16.lr.ph, label %if.end103
 
 for.body16.lr.ph:                                 ; preds = %for.cond14.preheader
   br label %for.body16
 
 for.body3:                                        ; preds = %for.inc11, %for.end
-  br i1 undef, label %if.then7, label %for.inc11
+  br i1 %arg, label %if.then7, label %for.inc11
 
 if.then7:                                         ; preds = %for.body3
   br label %for.inc11
@@ -71,13 +71,13 @@ for.inc11:                                        ; preds = %if.then7, %for.body
   br i1 false, label %for.cond14.preheader, label %for.body3
 
 for.body16:                                       ; preds = %for.body16, %for.body16.lr.ph
-  br i1 undef, label %for.end39, label %for.body16
+  br i1 %arg, label %for.end39, label %for.body16
 
 for.end39:                                        ; preds = %for.body16
-  br i1 undef, label %if.end103, label %for.cond45.preheader
+  br i1 %arg, label %if.end103, label %for.cond45.preheader
 
 for.cond45.preheader:                             ; preds = %for.end39
-  br i1 undef, label %if.then88, label %if.else
+  br i1 %arg, label %if.then88, label %if.else
 
 if.then88:                                        ; preds = %for.cond45.preheader
   %mul89 = fmul double 0.000000e+00, 0.000000e+00
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod.ll
index f0d38e1bf269c4..3ad0473c847665 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_lencod.ll
@@ -5,34 +5,34 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
 target triple = "x86_64-apple-macosx10.8.0"
 
 ; Function Attrs: nounwind ssp uwtable
-define void @RCModelEstimator() {
+define void @RCModelEstimator(i1 %arg) {
 ; CHECK-LABEL: @RCModelEstimator(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END_THREAD:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END_THREAD:%.*]]
 ; CHECK:       for.end.thread:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       for.body.lr.ph:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END]], label [[FOR_BODY]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END]], label [[FOR_BODY]]
 ; CHECK:       for.end:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY3:%.*]], label [[IF_END103:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY3:%.*]], label [[IF_END103:%.*]]
 ; CHECK:       for.cond14.preheader:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY16_LR_PH:%.*]], label [[IF_END103]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY16_LR_PH:%.*]], label [[IF_END103]]
 ; CHECK:       for.body16.lr.ph:
 ; CHECK-NEXT:    br label [[FOR_BODY16:%.*]]
 ; CHECK:       for.body3:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN7:%.*]], label [[FOR_INC11:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN7:%.*]], label [[FOR_INC11:%.*]]
 ; CHECK:       if.then7:
 ; CHECK-NEXT:    br label [[FOR_INC11]]
 ; CHECK:       for.inc11:
 ; CHECK-NEXT:    br i1 false, label [[FOR_COND14_PREHEADER:%.*]], label [[FOR_BODY3]]
 ; CHECK:       for.body16:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END39:%.*]], label [[FOR_BODY16]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END39:%.*]], label [[FOR_BODY16]]
 ; CHECK:       for.end39:
-; CHECK-NEXT:    br i1 undef, label [[IF_END103]], label [[FOR_COND45_PREHEADER:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END103]], label [[FOR_COND45_PREHEADER:%.*]]
 ; CHECK:       for.cond45.preheader:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN88:%.*]], label [[IF_ELSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN88:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then88:
 ; CHECK-NEXT:    br label [[IF_END103]]
 ; CHECK:       if.else:
@@ -41,28 +41,28 @@ define void @RCModelEstimator() {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %for.body.lr.ph, label %for.end.thread
+  br i1 %arg, label %for.body.lr.ph, label %for.end.thread
 
 for.end.thread:                                   ; preds = %entry
   unreachable
 
 for.body.lr.ph:                                   ; preds = %entry
-  br i1 undef, label %for.end, label %for.body
+  br i1 %arg, label %for.end, label %for.body
 
 for.body:                                         ; preds = %for.body, %for.body.lr.ph
-  br i1 undef, label %for.end, label %for.body
+  br i1 %arg, label %for.end, label %for.body
 
 for.end:                                          ; preds = %for.body, %for.body.lr.ph
-  br i1 undef, label %for.body3, label %if.end103
+  br i1 %arg, label %for.body3, label %if.end103
 
 for.cond14.preheader:                             ; preds = %for.inc11
-  br i1 undef, label %for.body16.lr.ph, label %if.end103
+  br i1 %arg, label %for.body16.lr.ph, label %if.end103
 
 for.body16.lr.ph:                                 ; preds = %for.cond14.preheader
   br label %for.body16
 
 for.body3:                                        ; preds = %for.inc11, %for.end
-  br i1 undef, label %if.then7, label %for.inc11
+  br i1 %arg, label %if.then7, label %for.inc11
 
 if.then7:                                         ; preds = %for.body3
   br label %for.inc11
@@ -71,13 +71,13 @@ for.inc11:                                        ; preds = %if.then7, %for.body
   br i1 false, label %for.cond14.preheader, label %for.body3
 
 for.body16:                                       ; preds = %for.body16, %for.body16.lr.ph
-  br i1 undef, label %for.end39, label %for.body16
+  br i1 %arg, label %for.end39, label %for.body16
 
 for.end39:                                        ; preds = %for.body16
-  br i1 undef, label %if.end103, label %for.cond45.preheader
+  br i1 %arg, label %if.end103, label %for.cond45.preheader
 
 for.cond45.preheader:                             ; preds = %for.end39
-  br i1 undef, label %if.then88, label %if.else
+  br i1 %arg, label %if.then88, label %if.else
 
 if.then88:                                        ; preds = %for.cond45.preheader
   %mul89 = fmul double 0.000000e+00, 0.000000e+00
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll
index e6c46e1847daca..403a610da8d554 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll
@@ -4,7 +4,7 @@
 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-S128"
 target triple = "x86_64-apple-macosx10.8.0"
 
-define void @main() {
+define void @main(i1 %arg) {
 ; CHECK-LABEL: @main(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
@@ -27,17 +27,17 @@ define void @main() {
 ; CHECK-NEXT:    [[ADD19]] = fadd double undef, [[MUL18]]
 ; CHECK-NEXT:    [[SUB:%.*]] = fsub double [[MUL13]], [[MUL14]]
 ; CHECK-NEXT:    [[ADD20]] = fadd double undef, [[SUB]]
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY12]], label [[FOR_INC21]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY12]], label [[FOR_INC21]]
 ; CHECK:       for.inc21:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END23:%.*]], label [[FOR_BODY6]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END23:%.*]], label [[FOR_BODY6]]
 ; CHECK:       for.end23:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN25:%.*]], label [[IF_THEN26:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN25:%.*]], label [[IF_THEN26:%.*]]
 ; CHECK:       if.then25:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END44:%.*]], label [[FOR_COND4_PREHEADER]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END44:%.*]], label [[FOR_COND4_PREHEADER]]
 ; CHECK:       if.then26:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       for.end44:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END48:%.*]], label [[FOR_BODY]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END48:%.*]], label [[FOR_BODY]]
 ; CHECK:       for.end48:
 ; CHECK-NEXT:    ret void
 ;
@@ -67,22 +67,22 @@ if.end:                                           ; preds = %for.body12
   %add19 = fadd double undef, %mul18
   %sub = fsub double %mul13, %mul14
   %add20 = fadd double undef, %sub
-  br i1 undef, label %for.body12, label %for.inc21
+  br i1 %arg, label %for.body12, label %for.inc21
 
 for.inc21:                                        ; preds = %if.end, %for.body12
-  br i1 undef, label %for.end23, label %for.body6
+  br i1 %arg, label %for.end23, label %for.body6
 
 for.end23:                                        ; preds = %for.inc21
-  br i1 undef, label %if.then25, label %if.then26
+  br i1 %arg, label %if.then25, label %if.then26
 
 if.then25:                                        ; preds = %for.end23
-  br i1 undef, label %for.end44, label %for.cond4.preheader
+  br i1 %arg, label %for.end44, label %for.cond4.preheader
 
 if.then26:                                        ; preds = %for.end23
   unreachable
 
 for.end44:                                        ; preds = %if.then25
-  br i1 undef, label %for.end48, label %for.body
+  br i1 %arg, label %for.end48, label %for.body
 
 for.end48:                                        ; preds = %for.end44
   ret void
@@ -90,7 +90,7 @@ for.end48:                                        ; preds = %for.end44
 
 %struct.hoge = type { double, double, double}
 
-define void @zot(ptr %arg) {
+define void @zot(ptr %arg, i1 %arg2) {
 ; CHECK-LABEL: @zot(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    [[TMP:%.*]] = load double, ptr undef, align 8
@@ -102,7 +102,7 @@ define void @zot(ptr %arg) {
 ; CHECK-NEXT:    [[TMP3:%.*]] = fmul <2 x double> [[TMP2]], undef
 ; CHECK-NEXT:    [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], undef
 ; CHECK-NEXT:    store <2 x double> [[TMP4]], ptr [[TMP7]], align 8
-; CHECK-NEXT:    br i1 undef, label [[BB11:%.*]], label [[BB12:%.*]]
+; CHECK-NEXT:    br i1 %arg2, label [[BB11:%.*]], label [[BB12:%.*]]
 ; CHECK:       bb11:
 ; CHECK-NEXT:    br label [[BB14:%.*]]
 ; CHECK:       bb12:
@@ -124,7 +124,7 @@ bb:
   %tmp9 = fsub double %tmp8, undef
   %tmp10 = getelementptr inbounds %struct.hoge, ptr %arg, i64 0, i32 2
   store double %tmp9, ptr %tmp10, align 8
-  br i1 undef, label %bb11, label %bb12
+  br i1 %arg2, label %bb11, label %bb12
 
 bb11:                                             ; preds = %bb
   br label %bb14
@@ -140,15 +140,15 @@ bb14:                                             ; preds = %bb12, %bb11
 
 %struct.rc4_state.0.24 = type { i32, i32, [256 x i32] }
 
-define void @rc4_crypt(ptr nocapture %s) {
+define void @rc4_crypt(ptr nocapture %s, i1 %arg) {
 ; CHECK-LABEL: @rc4_crypt(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[Y2:%.*]] = getelementptr inbounds [[STRUCT_RC4_STATE_0_24:%.*]], ptr [[S:%.*]], i64 0, i32 1
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
 ; CHECK:       for.body:
 ; CHECK-NEXT:    [[CONV4:%.*]] = and i32 undef, 255
 ; CHECK-NEXT:    [[CONV7:%.*]] = and i32 undef, 255
-; CHECK-NEXT:    br i1 undef, label [[FOR_END]], label [[FOR_BODY]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END]], label [[FOR_BODY]]
 ; CHECK:       for.end:
 ; CHECK-NEXT:    [[X_0_LCSSA:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[CONV4]], [[FOR_BODY]] ]
 ; CHECK-NEXT:    [[Y_0_LCSSA:%.*]] = phi i32 [ undef, [[ENTRY]] ], [ [[CONV7]], [[FOR_BODY]] ]
@@ -158,14 +158,14 @@ define void @rc4_crypt(ptr nocapture %s) {
 ;
 entry:
   %y2 = getelementptr inbounds %struct.rc4_state.0.24, ptr %s, i64 0, i32 1
-  br i1 undef, label %for.body, label %for.end
+  br i1 %arg, label %for.body, label %for.end
 
 for.body:                                         ; preds = %for.body, %entry
   %x.045 = phi i32 [ %conv4, %for.body ], [ undef, %entry ]
   %conv4 = and i32 undef, 255
   %conv7 = and i32 undef, 255
   %idxprom842 = zext i32 %conv7 to i64
-  br i1 undef, label %for.end, label %for.body
+  br i1 %arg, label %for.end, label %for.body
 
 for.end:                                          ; preds = %for.body, %entry
   %x.0.lcssa = phi i32 [ undef, %entry ], [ %conv4, %for.body ]
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll
index a9f92f324d6f54..d434035051f5e0 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_sim4b1.ll
@@ -6,28 +6,28 @@ target triple = "x86_64-apple-macosx10.8.0"
 
 %struct._exon_t.12.103.220.363.480.649.740.857.1039.1065.1078.1091.1117.1130.1156.1169.1195.1221.1234.1286.1299.1312.1338.1429.1455.1468.1494.1520.1884.1897.1975.2066.2105.2170.2171 = type { i32, i32, i32, i32, i32, i32, [8 x i8] }
 
-define void @SIM4() {
+define void @SIM4(i1 %arg) {
 ; CHECK-LABEL: @SIM4(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[RETURN:%.*]], label [[LOR_LHS_FALSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN:%.*]], label [[LOR_LHS_FALSE:%.*]]
 ; CHECK:       lor.lhs.false:
-; CHECK-NEXT:    br i1 undef, label [[RETURN]], label [[IF_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[RETURN]], label [[IF_END:%.*]]
 ; CHECK:       if.end:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END605:%.*]], label [[FOR_BODY_LR_PH:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END605:%.*]], label [[FOR_BODY_LR_PH:%.*]]
 ; CHECK:       for.body.lr.ph:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
-; CHECK-NEXT:    br i1 undef, label [[FOR_INC603:%.*]], label [[IF_END12:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_INC603:%.*]], label [[IF_END12:%.*]]
 ; CHECK:       if.end12:
-; CHECK-NEXT:    br i1 undef, label [[LAND_LHS_TRUE:%.*]], label [[LAND_LHS_TRUE167:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LAND_LHS_TRUE:%.*]], label [[LAND_LHS_TRUE167:%.*]]
 ; CHECK:       land.lhs.true:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN17:%.*]], label [[LAND_LHS_TRUE167]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN17:%.*]], label [[LAND_LHS_TRUE167]]
 ; CHECK:       if.then17:
-; CHECK-NEXT:    br i1 undef, label [[IF_END98:%.*]], label [[LAND_RHS_LR_PH:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END98:%.*]], label [[LAND_RHS_LR_PH:%.*]]
 ; CHECK:       land.rhs.lr.ph:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       if.end98:
-; CHECK-NEXT:    br i1 undef, label [[LAND_LHS_TRUE167]], label [[IF_THEN103:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LAND_LHS_TRUE167]], label [[IF_THEN103:%.*]]
 ; CHECK:       if.then103:
 ; CHECK-NEXT:    [[DOTSUB100:%.*]] = select i1 undef, i32 250, i32 undef
 ; CHECK-NEXT:    [[MUL114:%.*]] = shl nsw i32 [[DOTSUB100]], 2
@@ -37,11 +37,11 @@ define void @SIM4() {
 ; CHECK-NEXT:    br label [[FOR_COND_I:%.*]]
 ; CHECK:       for.cond.i:
 ; CHECK-NEXT:    [[TMP2:%.*]] = phi <2 x i32> [ undef, [[LAND_RHS_I874:%.*]] ], [ [[TMP1]], [[IF_THEN103]] ]
-; CHECK-NEXT:    br i1 undef, label [[LAND_RHS_I874]], label [[FOR_END_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LAND_RHS_I874]], label [[FOR_END_I:%.*]]
 ; CHECK:       land.rhs.i874:
-; CHECK-NEXT:    br i1 undef, label [[FOR_COND_I]], label [[FOR_END_I]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_COND_I]], label [[FOR_END_I]]
 ; CHECK:       for.end.i:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN_I:%.*]], label [[IF_END_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN_I:%.*]], label [[IF_END_I:%.*]]
 ; CHECK:       if.then.i:
 ; CHECK-NEXT:    [[TMP3:%.*]] = add nsw <2 x i32> [[TMP2]], undef
 ; CHECK-NEXT:    br label [[EXTEND_BW_EXIT:%.*]]
@@ -52,15 +52,15 @@ define void @SIM4() {
 ; CHECK:       for.body28.lr.ph.i:
 ; CHECK-NEXT:    br label [[FOR_END33_I]]
 ; CHECK:       for.end33.i:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END58_I:%.*]], label [[FOR_BODY52_LR_PH_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END58_I:%.*]], label [[FOR_BODY52_LR_PH_I:%.*]]
 ; CHECK:       for.body52.lr.ph.i:
 ; CHECK-NEXT:    br label [[FOR_END58_I]]
 ; CHECK:       for.end58.i:
 ; CHECK-NEXT:    br label [[WHILE_COND260_I:%.*]]
 ; CHECK:       while.cond260.i:
-; CHECK-NEXT:    br i1 undef, label [[LAND_RHS263_I:%.*]], label [[WHILE_END275_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LAND_RHS263_I:%.*]], label [[WHILE_END275_I:%.*]]
 ; CHECK:       land.rhs263.i:
-; CHECK-NEXT:    br i1 undef, label [[WHILE_COND260_I]], label [[WHILE_END275_I]]
+; CHECK-NEXT:    br i1 %arg, label [[WHILE_COND260_I]], label [[WHILE_END275_I]]
 ; CHECK:       while.end275.i:
 ; CHECK-NEXT:    br label [[EXTEND_BW_EXIT]]
 ; CHECK:       extend_bw.exit:
@@ -73,42 +73,42 @@ define void @SIM4() {
 ; CHECK:       land.lhs.true167:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       for.inc603:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY]], label [[FOR_END605]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY]], label [[FOR_END605]]
 ; CHECK:       for.end605:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       return:
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %return, label %lor.lhs.false
+  br i1 %arg, label %return, label %lor.lhs.false
 
 lor.lhs.false:                                    ; preds = %entry
-  br i1 undef, label %return, label %if.end
+  br i1 %arg, label %return, label %if.end
 
 if.end:                                           ; preds = %lor.lhs.false
-  br i1 undef, label %for.end605, label %for.body.lr.ph
+  br i1 %arg, label %for.end605, label %for.body.lr.ph
 
 for.body.lr.ph:                                   ; preds = %if.end
   br label %for.body
 
 for.body:                                         ; preds = %for.inc603, %for.body.lr.ph
-  br i1 undef, label %for.inc603, label %if.end12
+  br i1 %arg, label %for.inc603, label %if.end12
 
 if.end12:                                         ; preds = %for.body
-  br i1 undef, label %land.lhs.true, label %land.lhs.true167
+  br i1 %arg, label %land.lhs.true, label %land.lhs.true167
 
 land.lhs.true:                                    ; preds = %if.end12
-  br i1 undef, label %if.then17, label %land.lhs.true167
+  br i1 %arg, label %if.then17, label %land.lhs.true167
 
 if.then17:                                        ; preds = %land.lhs.true
-  br i1 undef, label %if.end98, label %land.rhs.lr.ph
+  br i1 %arg, label %if.end98, label %land.rhs.lr.ph
 
 land.rhs.lr.ph:                                   ; preds = %if.then17
   unreachable
 
 if.end98:                                         ; preds = %if.then17
   %from299 = getelementptr inbounds %struct._exon_t.12.103.220.363.480.649.740.857.1039.1065.1078.1091.1117.1130.1156.1169.1195.1221.1234.1286.1299.1312.1338.1429.1455.1468.1494.1520.1884.1897.1975.2066.2105.2170.2171, ptr undef, i64 0, i32 1
-  br i1 undef, label %land.lhs.true167, label %if.then103
+  br i1 %arg, label %land.lhs.true167, label %if.then103
 
 if.then103:                                       ; preds = %if.end98
   %.sub100 = select i1 undef, i32 250, i32 undef
@@ -119,13 +119,13 @@ if.then103:                                       ; preds = %if.end98
 for.cond.i:                                       ; preds = %land.rhs.i874, %if.then103
   %row.0.i = phi i32 [ undef, %land.rhs.i874 ], [ %.sub100, %if.then103 ]
   %col.0.i = phi i32 [ undef, %land.rhs.i874 ], [ %cond125, %if.then103 ]
-  br i1 undef, label %land.rhs.i874, label %for.end.i
+  br i1 %arg, label %land.rhs.i874, label %for.end.i
 
 land.rhs.i874:                                    ; preds = %for.cond.i
-  br i1 undef, label %for.cond.i, label %for.end.i
+  br i1 %arg, label %for.cond.i, label %for.end.i
 
 for.end.i:                                        ; preds = %land.rhs.i874, %for.cond.i
-  br i1 undef, label %if.then.i, label %if.end.i
+  br i1 %arg, label %if.then.i, label %if.end.i
 
 if.then.i:                                        ; preds = %for.end.i
   %add14.i = add nsw i32 %row.0.i, undef
@@ -141,7 +141,7 @@ for.body28.lr.ph.i:                               ; preds = %if.end.i
   br label %for.end33.i
 
 for.end33.i:                                      ; preds = %for.body28.lr.ph.i, %if.end.i
-  br i1 undef, label %for.end58.i, label %for.body52.lr.ph.i
+  br i1 %arg, label %for.end58.i, label %for.body52.lr.ph.i
 
 for.body52.lr.ph.i:                               ; preds = %for.end33.i
   br label %for.end58.i
@@ -150,10 +150,10 @@ for.end58.i:                                      ; preds = %for.body52.lr.ph.i,
   br label %while.cond260.i
 
 while.cond260.i:                                  ; preds = %land.rhs263.i, %for.end58.i
-  br i1 undef, label %land.rhs263.i, label %while.end275.i
+  br i1 %arg, label %land.rhs263.i, label %while.end275.i
 
 land.rhs263.i:                                    ; preds = %while.cond260.i
-  br i1 undef, label %while.cond260.i, label %while.end275.i
+  br i1 %arg, label %while.cond260.i, label %while.end275.i
 
 while.end275.i:                                   ; preds = %land.rhs263.i, %while.cond260.i
   br label %extend_bw.exit
@@ -174,7 +174,7 @@ land.lhs.true167:                                 ; preds = %if.then157, %extend
   unreachable
 
 for.inc603:                                       ; preds = %for.body
-  br i1 undef, label %for.body, label %for.end605
+  br i1 %arg, label %for.body, label %for.end605
 
 for.end605:                                       ; preds = %for.inc603, %if.end
   unreachable
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll
index 42ad20ff578c10..d13a8578d1e00a 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll
@@ -4,25 +4,25 @@
 %struct.Ray = type { %struct.Vec, %struct.Vec }
 %struct.Vec = type { double, double, double }
 
-define void @main() {
+define void @main(i1 %arg) {
 ; CHECK-LABEL: @main(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[COND_TRUE:%.*]], label [[COND_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[COND_TRUE:%.*]], label [[COND_END:%.*]]
 ; CHECK:       cond.true:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       cond.end:
 ; CHECK-NEXT:    br label [[INVOKE_CONT:%.*]]
 ; CHECK:       invoke.cont:
-; CHECK-NEXT:    br i1 undef, label [[ARRAYCTOR_CONT:%.*]], label [[INVOKE_CONT]]
+; CHECK-NEXT:    br i1 %arg, label [[ARRAYCTOR_CONT:%.*]], label [[INVOKE_CONT]]
 ; CHECK:       arrayctor.cont:
 ; CHECK-NEXT:    [[AGG_TMP101211_SROA_0_0_IDX:%.*]] = getelementptr inbounds [[STRUCT_RAY:%.*]], ptr undef, i64 0, i32 1, i32 0
 ; CHECK-NEXT:    br label [[FOR_COND36_PREHEADER:%.*]]
 ; CHECK:       for.cond36.preheader:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY42_LR_PH_US:%.*]], label [[_Z5CLAMPD_EXIT_1:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY42_LR_PH_US:%.*]], label [[_Z5CLAMPD_EXIT_1:%.*]]
 ; CHECK:       cond.false51.us:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       cond.true48.us:
-; CHECK-NEXT:    br i1 undef, label [[COND_TRUE63_US:%.*]], label [[COND_FALSE66_US:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[COND_TRUE63_US:%.*]], label [[COND_FALSE66_US:%.*]]
 ; CHECK:       cond.false66.us:
 ; CHECK-NEXT:    [[ADD_I276_US:%.*]] = fadd double 0.000000e+00, 0x3EB0C6F7A0B5ED8D
 ; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x double> <double poison, double 0xBFA5CC2D1960285F>, double [[ADD_I276_US]], i32 0
@@ -36,12 +36,12 @@ define void @main() {
 ; CHECK:       cond.true63.us:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       for.body42.lr.ph.us:
-; CHECK-NEXT:    br i1 undef, label [[COND_TRUE48_US:%.*]], label [[COND_FALSE51_US:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[COND_TRUE48_US:%.*]], label [[COND_FALSE51_US:%.*]]
 ; CHECK:       _Z5clampd.exit.1:
 ; CHECK-NEXT:    br label [[FOR_COND36_PREHEADER]]
 ;
 entry:
-  br i1 undef, label %cond.true, label %cond.end
+  br i1 %arg, label %cond.true, label %cond.end
 
 cond.true:
   unreachable
@@ -50,7 +50,7 @@ cond.end:
   br label %invoke.cont
 
 invoke.cont:
-  br i1 undef, label %arrayctor.cont, label %invoke.cont
+  br i1 %arg, label %arrayctor.cont, label %invoke.cont
 
 arrayctor.cont:
   %agg.tmp99208.sroa.1.8.idx388 = getelementptr inbounds %struct.Ray, ptr undef, i64 0, i32 0, i32 1
@@ -59,13 +59,13 @@ arrayctor.cont:
   br label %for.cond36.preheader
 
 for.cond36.preheader:
-  br i1 undef, label %for.body42.lr.ph.us, label %_Z5clampd.exit.1
+  br i1 %arg, label %for.body42.lr.ph.us, label %_Z5clampd.exit.1
 
 cond.false51.us:
   unreachable
 
 cond.true48.us:
-  br i1 undef, label %cond.true63.us, label %cond.false66.us
+  br i1 %arg, label %cond.true63.us, label %cond.false66.us
 
 cond.false66.us:
   %add.i276.us = fadd double 0.000000e+00, 0.000001e+00
@@ -87,16 +87,16 @@ cond.true63.us:
   unreachable
 
 for.body42.lr.ph.us:
-  br i1 undef, label %cond.true48.us, label %cond.false51.us
+  br i1 %arg, label %cond.true48.us, label %cond.false51.us
 
 _Z5clampd.exit.1:
   br label %for.cond36.preheader
 }
 
-define void @test() {
+define void @test(i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN78:%.*]], label [[IF_THEN38:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN78:%.*]], label [[IF_THEN38:%.*]]
 ; CHECK:       if.then38:
 ; CHECK-NEXT:    [[AGG_TMP74663_SROA_0_0_IDX:%.*]] = getelementptr inbounds [[STRUCT_RAY:%.*]], ptr undef, i64 0, i32 1, i32 0
 ; CHECK-NEXT:    store <2 x double> <double 0x3FFA356C1D8A7F76, double 0x3FFDC4F38B38BEF4>, ptr [[AGG_TMP74663_SROA_0_0_IDX]], align 8
@@ -105,7 +105,7 @@ define void @test() {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %if.then78, label %if.then38
+  br i1 %arg, label %if.then78, label %if.then38
 
 if.then38:
   %mul.i.i790 = fmul double 0.0, 0.1
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll b/llvm/test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll
index e3a860a4c6f062..c7c4b06be2d193 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll
@@ -16,7 +16,7 @@ target triple = "x86_64-apple-macosx10.9.0"
 
 
 ;define fastcc void @bar() {
-define void @bar() {
+define void @bar(i1 %arg) {
 ; CHECK-LABEL: @bar(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    [[I:%.*]] = getelementptr inbounds [[TMP0:%.*]], ptr undef, i64 0, i32 1, i32 0
@@ -32,16 +32,16 @@ define void @bar() {
 ; CHECK-NEXT:    store double [[I7]], ptr [[I1]], align 8
 ; CHECK-NEXT:    [[I10]] = load double, ptr [[I3]], align 8
 ; CHECK-NEXT:    [[TMP0]] = load <2 x double>, ptr [[I2]], align 8
-; CHECK-NEXT:    br i1 undef, label [[BB11:%.*]], label [[BB12:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB11:%.*]], label [[BB12:%.*]]
 ; CHECK:       bb11:
 ; CHECK-NEXT:    ret void
 ; CHECK:       bb12:
 ; CHECK-NEXT:    store <2 x double> [[TMP0]], ptr [[I4]], align 8
-; CHECK-NEXT:    br i1 undef, label [[BB13:%.*]], label [[BB14:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB13:%.*]], label [[BB14:%.*]]
 ; CHECK:       bb13:
 ; CHECK-NEXT:    br label [[BB14]]
 ; CHECK:       bb14:
-; CHECK-NEXT:    br i1 undef, label [[BB15:%.*]], label [[BB16]]
+; CHECK-NEXT:    br i1 %arg, label [[BB15:%.*]], label [[BB16]]
 ; CHECK:       bb15:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       bb16:
@@ -51,7 +51,7 @@ define void @bar() {
 ; CHECK-NEXT:      i32 103, label [[BB6]]
 ; CHECK-NEXT:    ]
 ; CHECK:       bb17:
-; CHECK-NEXT:    br i1 undef, label [[BB6]], label [[BB18:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB6]], label [[BB18:%.*]]
 ; CHECK:       bb18:
 ; CHECK-NEXT:    unreachable
 ;
@@ -71,7 +71,7 @@ bb6:                                              ; preds = %bb17, %bb16, %bb16,
   store double %i7, ptr %i1, align 8
   %i9 = load double, ptr %i2, align 8
   %i10 = load double, ptr %i3, align 8
-  br i1 undef, label %bb11, label %bb12
+  br i1 %arg, label %bb11, label %bb12
 
 bb11:                                             ; preds = %bb6
   ret void
@@ -79,13 +79,13 @@ bb11:                                             ; preds = %bb6
 bb12:                                             ; preds = %bb6
   store double %i9, ptr %i4, align 8
   store double %i10, ptr %i5, align 8
-  br i1 undef, label %bb13, label %bb14
+  br i1 %arg, label %bb13, label %bb14
 
 bb13:                                             ; preds = %bb12
   br label %bb14
 
 bb14:                                             ; preds = %bb13, %bb12
-  br i1 undef, label %bb15, label %bb16
+  br i1 %arg, label %bb15, label %bb16
 
 bb15:                                             ; preds = %bb14
   unreachable
@@ -97,7 +97,7 @@ bb16:                                             ; preds = %bb14
   ]
 
 bb17:                                             ; preds = %bb16
-  br i1 undef, label %bb6, label %bb18
+  br i1 %arg, label %bb6, label %bb18
 
 bb18:                                             ; preds = %bb17
   unreachable
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/cse.ll b/llvm/test/Transforms/SLPVectorizer/X86/cse.ll
index 739e3964c2685f..7510b8fb83e34b 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/cse.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/cse.ll
@@ -280,10 +280,10 @@ return:                                           ; preds = %entry, %if.end
 
 @a = external global double, align 8
 
-define void @PR19646(ptr %this) {
+define void @PR19646(ptr %this, i1 %arg) {
 ; CHECK-LABEL: @PR19646(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[IF_END13:%.*]], label [[IF_END13]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END13:%.*]], label [[IF_END13]]
 ; CHECK:       sw.epilog7:
 ; CHECK-NEXT:    [[DOTIN:%.*]] = getelementptr inbounds [[CLASS_B_53_55:%.*]], ptr [[THIS:%.*]], i64 0, i32 0, i32 1
 ; CHECK-NEXT:    [[TMP0:%.*]] = load double, ptr [[DOTIN]], align 8
@@ -294,7 +294,7 @@ define void @PR19646(ptr %this) {
 ; CHECK-NEXT:    [[_DY:%.*]] = getelementptr inbounds [[CLASS_B_53_55]], ptr [[THIS]], i64 0, i32 0, i32 2
 ; CHECK-NEXT:    [[TMP2:%.*]] = load double, ptr [[_DY]], align 8
 ; CHECK-NEXT:    [[ADD10:%.*]] = fadd double [[ADD8]], [[TMP2]]
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN12:%.*]], label [[IF_END13]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN12:%.*]], label [[IF_END13]]
 ; CHECK:       if.then12:
 ; CHECK-NEXT:    [[TMP3:%.*]] = load double, ptr undef, align 8
 ; CHECK-NEXT:    br label [[IF_END13]]
@@ -304,7 +304,7 @@ define void @PR19646(ptr %this) {
 ; CHECK-NEXT:    unreachable
 ;
 entry:
-  br i1 undef, label %if.end13, label %if.end13
+  br i1 %arg, label %if.end13, label %if.end13
 
 sw.epilog7:                                       ; No predecessors!
   %.in = getelementptr inbounds %class.B.53.55, ptr %this, i64 0, i32 0, i32 1
@@ -316,7 +316,7 @@ sw.epilog7:                                       ; No predecessors!
   %_dy = getelementptr inbounds %class.B.53.55, ptr %this, i64 0, i32 0, i32 2
   %2 = load double, ptr %_dy, align 8
   %add10 = fadd double %add8, %2
-  br i1 undef, label %if.then12, label %if.end13
+  br i1 %arg, label %if.then12, label %if.end13
 
 if.then12:                                        ; preds = %sw.epilog7
   %3 = load double, ptr undef, align 8
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/memory-runtime-checks.ll b/llvm/test/Transforms/SLPVectorizer/X86/memory-runtime-checks.ll
index f614796916baa1..d474218e84cca5 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/memory-runtime-checks.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/memory-runtime-checks.ll
@@ -116,7 +116,7 @@ then:
 %struct.wombat.0 = type { %struct.bar }
 %struct.bar = type { [3 x double], [3 x double], double, double, i16, ptr, i32, [3 x double] }
 
-define double @preserve_loop_info(ptr %arg) {
+define double @preserve_loop_info(ptr %arg, i1 %arg2) {
 ; CHECK-LABEL: @preserve_loop_info(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP:%.*]] = alloca [3 x double], align 16
@@ -124,15 +124,15 @@ define double @preserve_loop_info(ptr %arg) {
 ; CHECK:       outer.header:
 ; CHECK-NEXT:    br label [[INNER:%.*]]
 ; CHECK:       inner:
-; CHECK-NEXT:    br i1 undef, label [[OUTER_LATCH:%.*]], label [[INNER]]
+; CHECK-NEXT:    br i1 %arg2, label [[OUTER_LATCH:%.*]], label [[INNER]]
 ; CHECK:       outer.latch:
-; CHECK-NEXT:    br i1 undef, label [[BB:%.*]], label [[OUTER_HEADER]]
+; CHECK-NEXT:    br i1 %arg2, label [[BB:%.*]], label [[OUTER_HEADER]]
 ; CHECK:       bb:
 ; CHECK-NEXT:    [[TMP5:%.*]] = load ptr, ptr undef, align 8
 ; CHECK-NEXT:    [[TMP7:%.*]] = getelementptr inbounds [3 x double], ptr [[TMP]], i64 0, i64 1
 ; CHECK-NEXT:    br label [[LOOP_3HEADER:%.*]]
 ; CHECK:       loop.3header:
-; CHECK-NEXT:    br i1 undef, label [[LOOP_3LATCH:%.*]], label [[BB9:%.*]]
+; CHECK-NEXT:    br i1 %arg2, label [[LOOP_3LATCH:%.*]], label [[BB9:%.*]]
 ; CHECK:       bb9:
 ; CHECK-NEXT:    [[TMP10:%.*]] = getelementptr inbounds [3 x double], ptr [[TMP5]], i64 undef, i64 1
 ; CHECK-NEXT:    store double undef, ptr [[TMP]], align 16
@@ -140,7 +140,7 @@ define double @preserve_loop_info(ptr %arg) {
 ; CHECK-NEXT:    store double [[TMP12]], ptr [[TMP7]], align 8
 ; CHECK-NEXT:    br label [[LOOP_3LATCH]]
 ; CHECK:       loop.3latch:
-; CHECK-NEXT:    br i1 undef, label [[BB14:%.*]], label [[LOOP_3HEADER]]
+; CHECK-NEXT:    br i1 %arg2, label [[BB14:%.*]], label [[LOOP_3HEADER]]
 ; CHECK:       bb14:
 ; CHECK-NEXT:    [[TMP15:%.*]] = call double undef(ptr [[TMP]], ptr [[ARG:%.*]])
 ; CHECK-NEXT:    ret double undef
@@ -153,10 +153,10 @@ outer.header:                                              ; preds = %bb3, %bb
   br label %inner
 
 inner:
-  br i1 undef, label %outer.latch, label %inner
+  br i1 %arg2, label %outer.latch, label %inner
 
 outer.latch:                                              ; preds = %bb16
-  br i1 undef, label %bb, label %outer.header
+  br i1 %arg2, label %bb, label %outer.header
 
 bb:                                              ; preds = %bb3
   %tmp5 = load ptr, ptr undef, align 8
@@ -164,7 +164,7 @@ bb:                                              ; preds = %bb3
   br label %loop.3header
 
 loop.3header:                                              ; preds = %bb13, %bb4
-  br i1 undef, label %loop.3latch, label %bb9
+  br i1 %arg2, label %loop.3latch, label %bb9
 
 bb9:                                              ; preds = %bb8
   %tmp10 = getelementptr inbounds [3 x double], ptr %tmp5, i64 undef, i64 1
@@ -174,7 +174,7 @@ bb9:                                              ; preds = %bb8
   br label %loop.3latch
 
 loop.3latch:                                             ; preds = %bb11, %bb8
-  br i1 undef, label %bb14, label %loop.3header
+  br i1 %arg2, label %bb14, label %loop.3header
 
 bb14:                                             ; preds = %bb13
   %tmp15 = call double undef(ptr %tmp, ptr %arg)
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/no-scheduled-instructions.ll b/llvm/test/Transforms/SLPVectorizer/X86/no-scheduled-instructions.ll
index 43d8c1342cbbc0..eea22c1861b44e 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/no-scheduled-instructions.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/no-scheduled-instructions.ll
@@ -1,10 +1,10 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
 ; RUN: opt -S -passes=slp-vectorizer -mattr=+avx -mtriple=x86_64 < %s | FileCheck %s
 
-define void @test() {
+define void @test(i1 %arg) {
 ; CHECK-LABEL: define void @test
-; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK-SAME: (i1 %arg) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:    br i1 %arg, label [[BB1:%.*]], label [[BB2:%.*]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @llvm.vector.reduce.mul.v8i32(<8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 undef, i32 undef, i32 undef, i32 undef>)
 ; CHECK-NEXT:    call void @f(i32 noundef [[TMP1]])
@@ -20,7 +20,7 @@ define void @test() {
   %i32 = extractelement <4 x i32> zeroinitializer, i64 1
   %i33 = extractelement <4 x i32> zeroinitializer, i64 2
   %i34 = extractelement <4 x i32> zeroinitializer, i64 3
-  br i1 undef, label %bb1, label %bb2
+  br i1 %arg, label %bb1, label %bb2
 
 bb1:
   %i11 = mul nsw i32 %i28, %i27
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/ordering.ll b/llvm/test/Transforms/SLPVectorizer/X86/ordering.ll
index ad3ebf57ab7a48..f9d6c3eab350f0 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/ordering.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/ordering.ll
@@ -26,10 +26,10 @@ entry:
 declare ptr @objc_msgSend(ptr, ptr, ...)
 declare i32 @personality_v0(...)
 
-define void @invoketest() personality ptr @personality_v0 {
+define void @invoketest(i1 %arg) personality ptr @personality_v0 {
 ; CHECK-LABEL: @invoketest(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
 ; CHECK:       cond.true:
 ; CHECK-NEXT:    [[CALL49:%.*]] = invoke double @objc_msgSend(ptr undef, ptr undef)
 ; CHECK-NEXT:    to label [[COND_TRUE54:%.*]] unwind label [[LPAD:%.*]]
@@ -43,7 +43,7 @@ define void @invoketest() personality ptr @personality_v0 {
 ; CHECK-NEXT:    [[CALL59:%.*]] = invoke double @objc_msgSend(ptr undef, ptr undef)
 ; CHECK-NEXT:    to label [[COND_END60]] unwind label [[LPAD]]
 ; CHECK:       cond.end60:
-; CHECK-NEXT:    br i1 undef, label [[IF_END98:%.*]], label [[IF_THEN63:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END98:%.*]], label [[IF_THEN63:%.*]]
 ; CHECK:       if.then63:
 ; CHECK-NEXT:    br label [[IF_END98]]
 ; CHECK:       lpad:
@@ -56,7 +56,7 @@ define void @invoketest() personality ptr @personality_v0 {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %cond.true, label %cond.false
+  br i1 %arg, label %cond.true, label %cond.false
 
 cond.true:
   %call49 = invoke double @objc_msgSend(ptr undef, ptr undef)
@@ -77,7 +77,7 @@ cond.false57:
 cond.end60:
   %cond126 = phi double [ %call49, %cond.true54 ], [ %call51, %cond.false57 ]
   %cond61 = phi double [ %call56, %cond.true54 ], [ %call59, %cond.false57 ]
-  br i1 undef, label %if.end98, label %if.then63
+  br i1 %arg, label %if.end98, label %if.then63
 
 if.then63:
   %conv69 = fptrunc double undef to float
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/partail.ll b/llvm/test/Transforms/SLPVectorizer/X86/partail.ll
index 20ad09a6328268..4cdf9670394f1e 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/partail.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/partail.ll
@@ -2,12 +2,12 @@
 ; RUN: opt -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 < %s | FileCheck %s
 
 ; Function Attrs: nounwind uwtable
-define void @get_block(i32 %y_pos) local_unnamed_addr #0 {
+define void @get_block(i32 %y_pos, i1 %arg) local_unnamed_addr #0 {
 ; CHECK-LABEL: @get_block(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[LAND_LHS_TRUE:%.*]]
 ; CHECK:       land.lhs.true:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN:%.*]], label [[IF_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN:%.*]], label [[IF_END:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       if.end:
@@ -43,7 +43,7 @@ entry:
   br label %land.lhs.true
 
 land.lhs.true:                                    ; preds = %entry
-  br i1 undef, label %if.then, label %if.end
+  br i1 %arg, label %if.then, label %if.end
 
 if.then:                                          ; preds = %land.lhs.true
   unreachable
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/phi.ll b/llvm/test/Transforms/SLPVectorizer/X86/phi.ll
index 78bfb8df51aebb..df85656800aac2 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/phi.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/phi.ll
@@ -277,13 +277,13 @@ for.end:                                          ; preds = %for.body
   ret float %add31
 }
 
-define void @test(ptr %i1, ptr %i2, ptr %o) {
+define void @test(ptr %i1, ptr %i2, ptr %o, i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[I1_0:%.*]] = load x86_fp80, ptr [[I1:%.*]], align 16
 ; CHECK-NEXT:    [[I1_GEP1:%.*]] = getelementptr x86_fp80, ptr [[I1]], i64 1
 ; CHECK-NEXT:    [[I1_1:%.*]] = load x86_fp80, ptr [[I1_GEP1]], align 16
-; CHECK-NEXT:    br i1 undef, label [[THEN:%.*]], label [[END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[THEN:%.*]], label [[END:%.*]]
 ; CHECK:       then:
 ; CHECK-NEXT:    [[I2_0:%.*]] = load x86_fp80, ptr [[I2:%.*]], align 16
 ; CHECK-NEXT:    [[I2_GEP1:%.*]] = getelementptr inbounds x86_fp80, ptr [[I2]], i64 1
@@ -305,7 +305,7 @@ entry:
   %i1.0 = load x86_fp80, ptr %i1, align 16
   %i1.gep1 = getelementptr x86_fp80, ptr %i1, i64 1
   %i1.1 = load x86_fp80, ptr %i1.gep1, align 16
-  br i1 undef, label %then, label %end
+  br i1 %arg, label %then, label %end
 
 then:
   %i2.0 = load x86_fp80, ptr %i2, align 16
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll b/llvm/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll
index 88ac2d9dc42d12..ddbe943e324466 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/phi_overalignedtype.ll
@@ -6,7 +6,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
 target triple = "i386-apple-macosx10.9.0"
 
 
-define void @test(ptr %i1, ptr %i2, ptr %o) {
+define void @test(ptr %i1, ptr %i2, ptr %o, i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[I1_0:%.*]] = load double, ptr [[I1:%.*]], align 16
@@ -14,7 +14,7 @@ define void @test(ptr %i1, ptr %i2, ptr %o) {
 ; CHECK-NEXT:    [[I1_1:%.*]] = load double, ptr [[I1_GEP1]], align 16
 ; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x double> poison, double [[I1_0]], i32 0
 ; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <2 x double> [[TMP0]], double [[I1_1]], i32 1
-; CHECK-NEXT:    br i1 undef, label [[THEN:%.*]], label [[END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[THEN:%.*]], label [[END:%.*]]
 ; CHECK:       then:
 ; CHECK-NEXT:    [[I2_0:%.*]] = load double, ptr [[I2:%.*]], align 16
 ; CHECK-NEXT:    [[I2_GEP1:%.*]] = getelementptr inbounds double, ptr [[I2]], i64 1
@@ -38,7 +38,7 @@ entry:
   %i1.0 = load double, ptr %i1, align 16
   %i1.gep1 = getelementptr double, ptr %i1, i64 1
   %i1.1 = load double, ptr %i1.gep1, align 16
-  br i1 undef, label %then, label %end
+  br i1 %arg, label %then, label %end
 
 then:
   %i2.0 = load double, ptr %i2, align 16
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/pr16571.ll b/llvm/test/Transforms/SLPVectorizer/X86/pr16571.ll
index b61b004797959a..733033efa3bfe4 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/pr16571.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/pr16571.ll
@@ -3,9 +3,9 @@
 target datalayout = "e-p:32:32:32-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-f80:32:32-n8:16:32-S32"
 target triple = "i686-pc-win32"
 
-define hidden fastcc void @"System.PrimitiveTypesParser.TryParseIEEE754<char>(char*,uint,double&)"() unnamed_addr {
+define hidden fastcc void @"System.PrimitiveTypesParser.TryParseIEEE754<char>(char*,uint,double&)"(i1 %arg) unnamed_addr {
 "@0":
-  br i1 undef, label %"@38.lr.ph", label %"@37"
+  br i1 %arg, label %"@38.lr.ph", label %"@37"
 
 "@37":                                            ; preds = %"@38.lr.ph", %"@44", %"@0"
   ret void
@@ -13,10 +13,10 @@ define hidden fastcc void @"System.PrimitiveTypesParser.TryParseIEEE754<char>(ch
 "@44":                                            ; preds = %"@38.lr.ph"
   %0 = add i64 undef, undef
   %1 = add i32 %mainPartDigits.loc.0.ph45, 1
-  br i1 undef, label %"@38.lr.ph", label %"@37"
+  br i1 %arg, label %"@38.lr.ph", label %"@37"
 
 "@38.lr.ph":                                      ; preds = %"@44", %"@0"
   %mainDoublePart.loc.0.ph46 = phi i64 [ %0, %"@44" ], [ 0, %"@0" ]
   %mainPartDigits.loc.0.ph45 = phi i32 [ %1, %"@44" ], [ 0, %"@0" ]
-  br i1 undef, label %"@44", label %"@37"
+  br i1 %arg, label %"@44", label %"@37"
 }
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/remark_unsupported.ll b/llvm/test/Transforms/SLPVectorizer/X86/remark_unsupported.ll
index 540ea4eb659fe3..ac8b2428a3deab 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/remark_unsupported.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/remark_unsupported.ll
@@ -3,13 +3,13 @@
 ; RUN: FileCheck --input-file=%t --check-prefix=YAML %s
 
 ; This type is not supported by SLP
-define i1 @test(ptr %i1, ptr %i2) {
+define i1 @test(ptr %i1, ptr %i2, i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[I1_0:%.*]] = load x86_fp80, ptr [[I1:%.*]], align 16
 ; CHECK-NEXT:    [[I1_GEP1:%.*]] = getelementptr x86_fp80, ptr [[I1]], i64 1
 ; CHECK-NEXT:    [[I1_1:%.*]] = load x86_fp80, ptr [[I1_GEP1]], align 16
-; CHECK-NEXT:    br i1 undef, label [[THEN:%.*]], label [[END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[THEN:%.*]], label [[END:%.*]]
 ; CHECK:       then:
 ; CHECK-NEXT:    [[I2_0:%.*]] = load x86_fp80, ptr [[I2:%.*]], align 16
 ; CHECK-NEXT:    [[I2_GEP1:%.*]] = getelementptr inbounds x86_fp80, ptr [[I2]], i64 1
@@ -25,7 +25,7 @@ entry:
   %i1.0 = load x86_fp80, ptr %i1, align 16
   %i1.gep1 = getelementptr x86_fp80, ptr %i1, i64 1
   %i1.1 = load x86_fp80, ptr %i1.gep1, align 16
-  br i1 undef, label %then, label %end
+  br i1 %arg, label %then, label %end
 then:
   %i2.0 = load x86_fp80, ptr %i2, align 16
   %i2.gep1 = getelementptr inbounds x86_fp80, ptr %i2, i64 1
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/reorder_repeated_ops.ll b/llvm/test/Transforms/SLPVectorizer/X86/reorder_repeated_ops.ll
index f9815529a23759..5f2199aef17ee4 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/reorder_repeated_ops.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/reorder_repeated_ops.ll
@@ -3,10 +3,10 @@
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
-define void @hoge() {
+define void @hoge(i1 %arg) {
 ; CHECK-LABEL: @hoge(
 ; CHECK-NEXT:  bb:
-; CHECK-NEXT:    br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB1:%.*]], label [[BB2:%.*]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    ret void
 ; CHECK:       bb2:
@@ -57,7 +57,7 @@ define void @hoge() {
 ; CHECK-NEXT:    unreachable
 ;
 bb:
-  br i1 undef, label %bb1, label %bb2
+  br i1 %arg, label %bb1, label %bb2
 
 bb1:                                              ; preds = %bb
   ret void
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/reorder_with_reordered_users.ll b/llvm/test/Transforms/SLPVectorizer/X86/reorder_with_reordered_users.ll
index 69b4639d9c1318..2e6df0007e08b0 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/reorder_with_reordered_users.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/reorder_with_reordered_users.ll
@@ -42,16 +42,16 @@
 ; comment out reorderTopToBottom() and remove the stores.
 
 
-define void @reorder_crash(ptr %ptr) {
+define void @reorder_crash(ptr %ptr, i1 %arg) {
 ; CHECK-LABEL: @reorder_crash(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[BB0:%.*]], label [[BB12:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB0:%.*]], label [[BB12:%.*]]
 ; CHECK:       bb0:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load <4 x float>, ptr [[PTR:%.*]], align 4
 ; CHECK-NEXT:    store <4 x float> [[TMP0]], ptr [[PTR]], align 4
 ; CHECK-NEXT:    br label [[BB3:%.*]]
 ; CHECK:       bb12:
-; CHECK-NEXT:    br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB1:%.*]], label [[BB2:%.*]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x float>, ptr [[PTR]], align 4
 ; CHECK-NEXT:    store <4 x float> [[TMP1]], ptr [[PTR]], align 4
@@ -69,7 +69,7 @@ entry:
   %gep1 = getelementptr inbounds float, ptr %ptr, i64 1
   %gep2 = getelementptr inbounds float, ptr %ptr, i64 2
   %gep3 = getelementptr inbounds float, ptr %ptr, i64 3
-  br i1 undef, label %bb0, label %bb12
+  br i1 %arg, label %bb0, label %bb12
 
 bb0:
   ; Used by phi in this order: 1, 0, 2, 3
@@ -86,7 +86,7 @@ bb0:
   br label %bb3
 
 bb12:
-  br i1 undef, label %bb1, label %bb2
+  br i1 %arg, label %bb1, label %bb2
 
 bb1:
   ; Used by phi in this order: 1, 0, 2, 3
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/resched.ll b/llvm/test/Transforms/SLPVectorizer/X86/resched.ll
index cb955ff91ed810..ef1149a108e291 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/resched.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/resched.ll
@@ -4,10 +4,10 @@
 %"struct.std::array" = type { [32 x i8] }
 
 ; Function Attrs: nounwind uwtable
-define fastcc void @_ZN12_GLOBAL__N_127PolynomialMultiplyRecognize9recognizeEv() unnamed_addr #0 align 2 {
+define fastcc void @_ZN12_GLOBAL__N_127PolynomialMultiplyRecognize9recognizeEv(i1 %arg) unnamed_addr #0 align 2 {
 ; CHECK-LABEL: @_ZN12_GLOBAL__N_127PolynomialMultiplyRecognize9recognizeEv(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[IF_END50_I:%.*]], label [[IF_THEN22_I:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END50_I:%.*]], label [[IF_THEN22_I:%.*]]
 ; CHECK:       if.then22.i:
 ; CHECK-NEXT:    [[SUB_I:%.*]] = add nsw i32 undef, -1
 ; CHECK-NEXT:    [[CONV31_I:%.*]] = and i32 undef, [[SUB_I]]
@@ -36,7 +36,7 @@ define fastcc void @_ZN12_GLOBAL__N_127PolynomialMultiplyRecognize9recognizeEv()
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %if.end50.i, label %if.then22.i
+  br i1 %arg, label %if.end50.i, label %if.then22.i
 
 if.then22.i:                                      ; preds = %entry
   %sub.i = add nsw i32 undef, -1
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/reuse-extracts-in-wider-vect.ll b/llvm/test/Transforms/SLPVectorizer/X86/reuse-extracts-in-wider-vect.ll
index 79ce74bd21dbcf..b900bd3a8c3318 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/reuse-extracts-in-wider-vect.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/reuse-extracts-in-wider-vect.ll
@@ -4,7 +4,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 
 %struct.S = type { [3 x float], [3 x float], [4 x float] }
 
-define i32 @foo(i32 %0, ptr %1, ptr %2)  {
+define i32 @foo(i32 %0, ptr %1, ptr %2, i1 %arg)  {
 ; CHECK-LABEL: @foo(
 ; CHECK-NEXT:    [[T4:%.*]] = alloca [[STRUCT_S:%.*]], align 8
 ; CHECK-NEXT:    [[T8:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[T4]], i64 0, i32 1
@@ -19,7 +19,7 @@ define i32 @foo(i32 %0, ptr %1, ptr %2)  {
 ; CHECK-NEXT:    [[T21:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[T4]], i64 0, i32 2, i64 0
 ; CHECK-NEXT:    store <4 x float> [[SHUFFLE]], ptr [[T21]], align 4
 ; CHECK-NEXT:    [[T89]] = load <2 x float>, ptr [[T9]], align 4
-; CHECK-NEXT:    br i1 undef, label [[T37]], label [[T55:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[T37]], label [[T55:%.*]]
 ; CHECK:       t55:
 ; CHECK-NEXT:    ret i32 0
 ;
@@ -49,7 +49,7 @@ t37:
   %t89 = load <2 x float>, ptr %t9, align 4
   %x23 = extractelement <2 x float> %t89, i32 0
   %x24 = extractelement <2 x float> %t89, i32 1
-  br i1 undef, label %t37, label %t55
+  br i1 %arg, label %t37, label %t55
 
 t55:
 
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/revectorized_rdx_crash.ll b/llvm/test/Transforms/SLPVectorizer/X86/revectorized_rdx_crash.ll
index edd1a2a3a2fff8..364b0f4c1a3a7a 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/revectorized_rdx_crash.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/revectorized_rdx_crash.ll
@@ -12,10 +12,10 @@
 ; iteration (it was matched and vectorized, which added a use of a deleted
 ; instruction)
 
-define void @test() {
+define void @test(i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[IF_END:%.*]], label [[FOR_COND_PREHEADER:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_END:%.*]], label [[FOR_COND_PREHEADER:%.*]]
 ; CHECK:       for.cond.preheader:
 ; CHECK-NEXT:    [[I:%.*]] = getelementptr inbounds [100 x i32], ptr undef, i64 0, i64 2
 ; CHECK-NEXT:    [[I1:%.*]] = getelementptr inbounds [100 x i32], ptr undef, i64 0, i64 3
@@ -35,7 +35,7 @@ define void @test() {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %if.end, label %for.cond.preheader
+  br i1 %arg, label %if.end, label %for.cond.preheader
 
 for.cond.preheader:                               ; preds = %entry
   %i = getelementptr inbounds [100 x i32], ptr undef, i64 0, i64 2
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/value-bug-inseltpoison.ll b/llvm/test/Transforms/SLPVectorizer/X86/value-bug-inseltpoison.ll
index eb5e218f057ce0..ac9454967719e4 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/value-bug-inseltpoison.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/value-bug-inseltpoison.ll
@@ -8,7 +8,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 ; as elements of the vectorized tree.
 ; PR19621
 
-define void @test() {
+define void @test(i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  bb279:
 ; CHECK-NEXT:    br label [[BB283:%.*]]
@@ -22,13 +22,13 @@ define void @test() {
 ; CHECK-NEXT:    [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], undef
 ; CHECK-NEXT:    br label [[BB21_I:%.*]]
 ; CHECK:       bb21.i:
-; CHECK-NEXT:    br i1 undef, label [[BB22_I:%.*]], label [[EXIT]]
+; CHECK-NEXT:    br i1 %arg, label [[BB22_I:%.*]], label [[EXIT]]
 ; CHECK:       bb22.i:
 ; CHECK-NEXT:    [[TMP5:%.*]] = fadd <2 x double> undef, [[TMP4]]
 ; CHECK-NEXT:    br label [[BB32_I:%.*]]
 ; CHECK:       bb32.i:
 ; CHECK-NEXT:    [[TMP6:%.*]] = phi <2 x double> [ [[TMP5]], [[BB22_I]] ], [ zeroinitializer, [[BB32_I]] ]
-; CHECK-NEXT:    br i1 undef, label [[BB32_I]], label [[BB21_I]]
+; CHECK-NEXT:    br i1 %arg, label [[BB32_I]], label [[BB21_I]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    [[TMP7:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
 ; CHECK-NEXT:    [[TMP8:%.*]] = fmul <2 x double> [[TMP7]], <double undef, double 0.000000e+00>
@@ -57,7 +57,7 @@ bb284:
   br label %bb21.i
 
 bb21.i:
-  br i1 undef, label %bb22.i, label %exit
+  br i1 %arg, label %bb22.i, label %exit
 
 bb22.i:
   %tmp24.i = fadd double undef, %tmp9.i
@@ -67,7 +67,7 @@ bb22.i:
 bb32.i:
   %xs.0.i = phi double [ %tmp24.i, %bb22.i ], [ 0.000000e+00, %bb32.i ]
   %ys.0.i = phi double [ %tmp26.i, %bb22.i ], [ 0.000000e+00, %bb32.i ]
-  br i1 undef, label %bb32.i, label %bb21.i
+  br i1 %arg, label %bb32.i, label %bb21.i
 
 exit:
   %tmp303 = fpext float %Av.sroa.0.0 to double
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/value-bug.ll b/llvm/test/Transforms/SLPVectorizer/X86/value-bug.ll
index f870cb44f4e5f6..c5cdcdc1eb1a59 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/value-bug.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/value-bug.ll
@@ -8,7 +8,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 ; as elements of the vectorized tree.
 ; PR19621
 
-define void @test() {
+define void @test(i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  bb279:
 ; CHECK-NEXT:    br label [[BB283:%.*]]
@@ -22,13 +22,13 @@ define void @test() {
 ; CHECK-NEXT:    [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], undef
 ; CHECK-NEXT:    br label [[BB21_I:%.*]]
 ; CHECK:       bb21.i:
-; CHECK-NEXT:    br i1 undef, label [[BB22_I:%.*]], label [[EXIT]]
+; CHECK-NEXT:    br i1 %arg, label [[BB22_I:%.*]], label [[EXIT]]
 ; CHECK:       bb22.i:
 ; CHECK-NEXT:    [[TMP5:%.*]] = fadd <2 x double> undef, [[TMP4]]
 ; CHECK-NEXT:    br label [[BB32_I:%.*]]
 ; CHECK:       bb32.i:
 ; CHECK-NEXT:    [[TMP6:%.*]] = phi <2 x double> [ [[TMP5]], [[BB22_I]] ], [ zeroinitializer, [[BB32_I]] ]
-; CHECK-NEXT:    br i1 undef, label [[BB32_I]], label [[BB21_I]]
+; CHECK-NEXT:    br i1 %arg, label [[BB32_I]], label [[BB21_I]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    [[TMP7:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
 ; CHECK-NEXT:    [[TMP8:%.*]] = fmul <2 x double> [[TMP7]], <double undef, double 0.000000e+00>
@@ -57,7 +57,7 @@ bb284:
   br label %bb21.i
 
 bb21.i:
-  br i1 undef, label %bb22.i, label %exit
+  br i1 %arg, label %bb22.i, label %exit
 
 bb22.i:
   %tmp24.i = fadd double undef, %tmp9.i
@@ -67,7 +67,7 @@ bb22.i:
 bb32.i:
   %xs.0.i = phi double [ %tmp24.i, %bb22.i ], [ 0.000000e+00, %bb32.i ]
   %ys.0.i = phi double [ %tmp26.i, %bb22.i ], [ 0.000000e+00, %bb32.i ]
-  br i1 undef, label %bb32.i, label %bb21.i
+  br i1 %arg, label %bb32.i, label %bb21.i
 
 exit:
   %tmp303 = fpext float %Av.sroa.0.0 to double
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll b/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll
index 17f9f371ff6ef9..a69849fabcef6a 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=slp-vectorizer -S -mcpu=cascadelake -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
 
-define void @foo() {
+define void @foo(i1 %arg) {
 ; CHECK-LABEL: @foo(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CONV:%.*]] = uitofp i16 undef to float
@@ -14,7 +14,7 @@ define void @foo() {
 ; CHECK:       bb2:
 ; CHECK-NEXT:    [[TMP2:%.*]] = phi <4 x float> [ [[TMP1]], [[BB1]] ], [ [[TMP14:%.*]], [[BB3:%.*]] ]
 ; CHECK-NEXT:    [[TMP3:%.*]] = load double, ptr undef, align 8
-; CHECK-NEXT:    br i1 undef, label [[BB3]], label [[BB4:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB3]], label [[BB4:%.*]]
 ; CHECK:       bb4:
 ; CHECK-NEXT:    [[TMP4:%.*]] = fpext <4 x float> [[TMP2]] to <4 x double>
 ; CHECK-NEXT:    [[CONV2:%.*]] = uitofp i16 undef to double
@@ -46,7 +46,7 @@ bb2:
   %2 = phi float [ undef, %bb1 ], [ %11, %bb3 ]
   %3 = phi float [ undef, %bb1 ], [ %12, %bb3 ]
   %4 = load double, ptr undef, align 8
-  br i1 undef, label %bb3, label %bb4
+  br i1 %arg, label %bb3, label %bb4
 
 bb4:
   %ext = fpext float %3 to double
diff --git a/llvm/test/Transforms/SLPVectorizer/slp-umax-rdx-matcher-crash.ll b/llvm/test/Transforms/SLPVectorizer/slp-umax-rdx-matcher-crash.ll
index 9d6371b13e08a4..a728515f0fdc33 100644
--- a/llvm/test/Transforms/SLPVectorizer/slp-umax-rdx-matcher-crash.ll
+++ b/llvm/test/Transforms/SLPVectorizer/slp-umax-rdx-matcher-crash.ll
@@ -7,10 +7,10 @@
 ; to UMax and thus same reduction kind is returned.
 ; The routine's later code merely assumes the instruction to be a select.
 
-define dso_local void @test() {
+define dso_local void @test(i1 %arg) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[NEXT:%.*]], label [[THEN:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[NEXT:%.*]], label [[THEN:%.*]]
 ; CHECK:       then:
 ; CHECK-NEXT:    [[UM:%.*]] = call i8 @llvm.umax.i8(i8 0, i8 undef)
 ; CHECK-NEXT:    [[SELCMP:%.*]] = icmp ult i8 [[UM]], undef
@@ -21,7 +21,7 @@ define dso_local void @test() {
 ; CHECK-NEXT:    ret void
 ;
 entry:
-  br i1 undef, label %next, label %then
+  br i1 %arg, label %next, label %then
 
 then:
   %um = call i8 @llvm.umax.i8(i8 0, i8 undef)

>From 4537b6e791f6e777836f456cd3b7e86448942487 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 19:59:46 -0700
Subject: [PATCH 5/9] Remove br i1 undef in Scalarizer directory

---
 llvm/test/Transforms/Scalarizer/crash-bug.ll  |  8 ++++----
 .../Scalarizer/dbgloc-bug-inseltpoison.ll     |  4 ++--
 llvm/test/Transforms/Scalarizer/dbgloc-bug.ll |  4 ++--
 .../Scalarizer/phi-unreachable-pred.ll        | 20 +++++++++----------
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/llvm/test/Transforms/Scalarizer/crash-bug.ll b/llvm/test/Transforms/Scalarizer/crash-bug.ll
index 2195a37564c6a1..692fc07e3ea5c1 100644
--- a/llvm/test/Transforms/Scalarizer/crash-bug.ll
+++ b/llvm/test/Transforms/Scalarizer/crash-bug.ll
@@ -3,14 +3,14 @@
 
 ; Don't crash
 
-define void @foo() {
-; CHECK-LABEL: define void @foo() {
+define void @foo(i1 %arg) {
+; CHECK-LABEL: define void @foo(i1 %arg) {
 ; CHECK-NEXT:    br label [[BB1:%.*]]
 ; CHECK:       bb2:
 ; CHECK-NEXT:    br label [[BB1]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    [[BB2_VEC_I1:%.*]] = phi i16 [ 200, [[TMP0:%.*]] ], [ [[BB2_VEC_I1]], [[BB2:%.*]] ]
-; CHECK-NEXT:    br i1 undef, label [[BB3:%.*]], label [[BB2]]
+; CHECK-NEXT:    br i1 %arg, label [[BB3:%.*]], label [[BB2]]
 ; CHECK:       bb3:
 ; CHECK-NEXT:    ret void
 ;
@@ -22,7 +22,7 @@ bb2:                                        ; preds = %bb1
 
 bb1:                                        ; preds = %bb2, %0
   %bb1_vec = phi <2 x i16> [ <i16 100, i16 200>, %0 ], [ %bb2_vec, %bb2 ]
-  br i1 undef, label %bb3, label %bb2
+  br i1 %arg, label %bb3, label %bb2
 
 bb3:
   ret void
diff --git a/llvm/test/Transforms/Scalarizer/dbgloc-bug-inseltpoison.ll b/llvm/test/Transforms/Scalarizer/dbgloc-bug-inseltpoison.ll
index e5ba35ca2c4ee2..4f4dff84e12942 100644
--- a/llvm/test/Transforms/Scalarizer/dbgloc-bug-inseltpoison.ll
+++ b/llvm/test/Transforms/Scalarizer/dbgloc-bug-inseltpoison.ll
@@ -7,7 +7,7 @@ define i16 @f1() !dbg !5 {
   ret i16 undef, !dbg !9
 }
 
-define void @f2() !dbg !10 {
+define void @f2(i1 %arg) !dbg !10 {
 bb1:
   %_tmp7 = tail call i16 @f1(), !dbg !13
 ; CHECK: call i16 @f1(), !dbg !13
@@ -16,7 +16,7 @@ bb1:
   br label %vector.body
 
 vector.body:
-  br i1 undef, label %middle.block, label %vector.body
+  br i1 %arg, label %middle.block, label %vector.body
 
 middle.block:
   ret void, !dbg !15
diff --git a/llvm/test/Transforms/Scalarizer/dbgloc-bug.ll b/llvm/test/Transforms/Scalarizer/dbgloc-bug.ll
index 639fd3d7c0957b..3dd768e593eb4c 100644
--- a/llvm/test/Transforms/Scalarizer/dbgloc-bug.ll
+++ b/llvm/test/Transforms/Scalarizer/dbgloc-bug.ll
@@ -7,7 +7,7 @@ define i16 @f1() !dbg !5 {
   ret i16 undef, !dbg !9
 }
 
-define void @f2() !dbg !10 {
+define void @f2(i1 %arg) !dbg !10 {
 bb1:
   %_tmp7 = tail call i16 @f1(), !dbg !13
 ; CHECK: call i16 @f1(), !dbg !13
@@ -16,7 +16,7 @@ bb1:
   br label %vector.body
 
 vector.body:
-  br i1 undef, label %middle.block, label %vector.body
+  br i1 %arg, label %middle.block, label %vector.body
 
 middle.block:
   ret void, !dbg !15
diff --git a/llvm/test/Transforms/Scalarizer/phi-unreachable-pred.ll b/llvm/test/Transforms/Scalarizer/phi-unreachable-pred.ll
index 3b6f5ccf3d3ea0..8ce912ff55d6e5 100644
--- a/llvm/test/Transforms/Scalarizer/phi-unreachable-pred.ll
+++ b/llvm/test/Transforms/Scalarizer/phi-unreachable-pred.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes='function(scalarizer)' -S -o - | FileCheck %s
 
-define i16 @f1() {
+define i16 @f1(i1 %arg) {
 ; CHECK-LABEL: @f1(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_END:%.*]]
@@ -9,7 +9,7 @@ define i16 @f1() {
 ; CHECK-NEXT:    [[INSERT:%.*]] = insertelement <4 x i16> [[INSERT]], i16 ptrtoint (ptr @f1 to i16), i32 0
 ; CHECK-NEXT:    br label [[FOR_COND:%.*]]
 ; CHECK:       for.cond:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY:%.*]], label [[FOR_END]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY:%.*]], label [[FOR_END]]
 ; CHECK:       for.end:
 ; CHECK-NEXT:    [[PHI_I0:%.*]] = phi i16 [ 1, [[ENTRY:%.*]] ], [ poison, [[FOR_COND]] ]
 ; CHECK-NEXT:    ret i16 [[PHI_I0]]
@@ -22,7 +22,7 @@ for.body:
   br label %for.cond
 
 for.cond:
-  br i1 undef, label %for.body, label %for.end
+  br i1 %arg, label %for.body, label %for.end
 
 for.end:
   ; opt used to hang when scalarizing this code. When scattering %insert we
@@ -34,22 +34,22 @@ for.end:
   ret i16 %extract
 }
 
-define void @f2() {
+define void @f2(i1 %arg) {
 ; CHECK-LABEL: @f2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN:%.*]], label [[IF_END8:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN:%.*]], label [[IF_END8:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    br label [[IF_END8]]
 ; CHECK:       for.body2:
-; CHECK-NEXT:    br i1 undef, label [[FOR_END:%.*]], label [[FOR_INC:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_END:%.*]], label [[FOR_INC:%.*]]
 ; CHECK:       for.end:
 ; CHECK-NEXT:    br label [[FOR_INC]]
 ; CHECK:       for.inc:
 ; CHECK-NEXT:    [[E_SROA_3_2:%.*]] = phi <2 x i64> [ splat (i64 1), [[FOR_END]] ], [ [[E_SROA_3_2]], [[FOR_BODY2:%.*]] ]
 ; CHECK-NEXT:    [[TMP0:%.*]] = phi i32 [ 6, [[FOR_END]] ], [ [[TMP0]], [[FOR_BODY2]] ]
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY2]], label [[FOR_COND1_FOR_END7_CRIT_EDGE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY2]], label [[FOR_COND1_FOR_END7_CRIT_EDGE:%.*]]
 ; CHECK:       for.cond1.for.end7_crit_edge:
 ; CHECK-NEXT:    br label [[IF_END8]]
 ; CHECK:       if.end8:
@@ -61,13 +61,13 @@ entry:
   br label %for.body
 
 for.body:                                         ; preds = %if.end8, %entry
-  br i1 undef, label %if.then, label %if.end8
+  br i1 %arg, label %if.then, label %if.end8
 
 if.then:                                          ; preds = %for.body
   br label %if.end8
 
 for.body2:                                        ; preds = %for.inc
-  br i1 undef, label %for.end, label %for.inc
+  br i1 %arg, label %for.end, label %for.inc
 
 for.end:                                          ; preds = %for.body2
   br label %for.inc
@@ -75,7 +75,7 @@ for.end:                                          ; preds = %for.body2
 for.inc:                                          ; preds = %for.end, %for.body2
   %e.sroa.3.2 = phi <2 x i64> [ <i64 1, i64 1>, %for.end ], [ %e.sroa.3.2, %for.body2 ]
   %0 = phi i32 [ 6, %for.end ], [ %0, %for.body2 ]
-  br i1 undef, label %for.body2, label %for.cond1.for.end7_crit_edge
+  br i1 %arg, label %for.body2, label %for.cond1.for.end7_crit_edge
 
 for.cond1.for.end7_crit_edge:                     ; preds = %for.inc
   br label %if.end8

>From ab7ec90e00140a8343c4b57814c2a61afe0b95b5 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 20:14:43 -0700
Subject: [PATCH 6/9] Remove br i1 undef in SimpleLoopUnswitch directory

---
 .../2011-06-02-CritSwitch.ll                  |  6 +--
 .../2012-04-30-LoopUnswitch-LPad-Crash.ll     |  4 +-
 .../2015-09-18-Addrspace.ll                   |  4 +-
 .../SimpleLoopUnswitch/delete-dead-blocks.ll  | 12 ++---
 .../formDedicatedAfterTrivial1.ll             |  4 +-
 .../Transforms/SimpleLoopUnswitch/guards.ll   | 54 ++++++++++++++-----
 .../Transforms/SimpleLoopUnswitch/pr37888.ll  |  2 +-
 .../SimpleLoopUnswitch/preserve-analyses.ll   | 12 ++---
 8 files changed, 62 insertions(+), 36 deletions(-)

diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/2011-06-02-CritSwitch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/2011-06-02-CritSwitch.ll
index 55c9d677ee529a..62e451f8f5ca85 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/2011-06-02-CritSwitch.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/2011-06-02-CritSwitch.ll
@@ -1,12 +1,12 @@
 ; RUN: opt -passes=simple-loop-unswitch -verify-memoryssa -disable-output < %s
 ; PR10031
 
-define i32 @test(i32 %command) {
+define i32 @test(i32 %command, i1 %arg) {
 entry:
   br label %tailrecurse
 
 tailrecurse:                                      ; preds = %if.then14, %tailrecurse, %entry
-  br i1 undef, label %if.then, label %tailrecurse
+  br i1 %arg, label %if.then, label %tailrecurse
 
 if.then:                                          ; preds = %tailrecurse
   switch i32 %command, label %sw.bb [
@@ -15,7 +15,7 @@ if.then:                                          ; preds = %tailrecurse
   ]
 
 land.lhs.true:                                    ; preds = %if.then, %if.then
-  br i1 undef, label %sw.bb, label %if.then14
+  br i1 %arg, label %sw.bb, label %if.then14
 
 if.then14:                                        ; preds = %land.lhs.true
   switch i32 %command, label %tailrecurse [
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll b/llvm/test/Transforms/SimpleLoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll
index 8ad869015f44e8..229bbb2f3929f1 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll
@@ -8,7 +8,7 @@ target triple = "x86_64-apple-macosx10.7.0"
 %class.B.21.41.65.101.137.157.177.197.237.241.245.249.261.293.301.337.345.378 = type { ptr }
 %class.A.20.40.64.100.136.156.176.196.236.240.244.248.260.292.300.336.344.377 = type { i8 }
 
-define void @_Z23get_reconstruction_pathv() uwtable ssp personality ptr @__gxx_personality_v0 {
+define void @_Z23get_reconstruction_pathv(i1 %arg) uwtable ssp personality ptr @__gxx_personality_v0 {
 entry:
   %c = alloca %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379, align 8
   br label %for.cond
@@ -30,7 +30,7 @@ invoke.cont4:                                     ; preds = %for.cond3
           to label %invoke.cont6 unwind label %lpad
 
 invoke.cont6:                                     ; preds = %invoke.cont4
-  br i1 undef, label %for.cond3, label %for.end
+  br i1 %arg, label %for.cond3, label %for.end
 
 lpad:                                             ; preds = %for.end, %invoke.cont4, %for.cond3, %invoke.cont, %for.cond
   %0 = landingpad { ptr, i32 }
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/2015-09-18-Addrspace.ll b/llvm/test/Transforms/SimpleLoopUnswitch/2015-09-18-Addrspace.ll
index ce767f14cf073d..8d5c0306306d8b 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/2015-09-18-Addrspace.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/2015-09-18-Addrspace.ll
@@ -6,12 +6,12 @@
 
 target datalayout = "e-m:e-p:16:16-p1:32:16-i32:16-i64:16-n8:16"
 
-define void @foo() {
+define void @foo(i1 %arg) {
 ; CHECK-LABEL: @foo
 entry:
   %arrayidx.i1 = getelementptr inbounds i16, ptr undef, i16 undef
   %arrayidx.i = addrspacecast ptr %arrayidx.i1 to ptr addrspace(1)
-  br i1 undef, label %for.body.i, label %bar.exit
+  br i1 %arg, label %for.body.i, label %bar.exit
 
 for.body.i:                                       ; preds = %for.body.i, %entry
 ; When we call makeLoopInvariant (i.e. trivial LICM) on this load, it
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll b/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
index 9ca554023a8cf3..e66c7ace18fc05 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
@@ -6,7 +6,7 @@
 declare void @foo()
 
 ; CHECK-LABEL: @Test
-define void @Test(i32) {
+define void @Test(i32, i1 %arg) {
 entry:
   br label %outer
 outer:
@@ -47,7 +47,7 @@ get_out2:
 ;
 ; This comes from PR38778
 ; CHECK-LABEL: @Test2
-define void @Test2(i32) {
+define void @Test2(i32, i1 %arg) {
 header:
   br label %loop
 loop:
@@ -58,12 +58,12 @@ loop:
   ]
 ; CHECK-NOT: {{^}}guarded1:
 guarded1:
-  br i1 undef, label %continue, label %leave
+  br i1 %arg, label %continue, label %leave
 guarded2:
   br label %continue
 check:
   %val = add i32 0, 1
-  br i1 undef, label %continue, label %leave
+  br i1 %arg, label %continue, label %leave
 continue:
   br label %loop
 leave:
@@ -75,7 +75,7 @@ leave:
 ; Yet another test from PR38778
 ;
 ; CHECK-LABEL: @Test3
-define void @Test3(i32) {
+define void @Test3(i32, i1 %arg) {
 header:
   br label %outer
 outer:
@@ -95,7 +95,7 @@ case2:
   br label %continue
 continue:
   %local_11_92 = phi i32 [ 0, %switchme ], [ 18, %case2 ], [ 0, %overflow ]
-  br i1 undef, label %outer, label %inner
+  br i1 %arg, label %outer, label %inner
 go_out:
   unreachable
 }
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/formDedicatedAfterTrivial1.ll b/llvm/test/Transforms/SimpleLoopUnswitch/formDedicatedAfterTrivial1.ll
index 19a2bc3ad04498..45da85299051f9 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/formDedicatedAfterTrivial1.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/formDedicatedAfterTrivial1.ll
@@ -2,7 +2,7 @@
 
 ; PR38283
 ; PR38737
-define void @f1() {
+define void @f1(i1 %arg) {
 for.cond1thread-pre-split.lr.ph.lr.ph:
   %tobool4 = icmp eq i16 undef, 0
   br label %for.cond1thread-pre-split
@@ -18,7 +18,7 @@ if.end:                                           ; preds = %for.body2
   br i1 %tobool4, label %if.end6, label %for.cond1thread-pre-split
 
 if.end6:                                          ; preds = %if.end
-  br i1 undef, label %for.body2, label %for.end
+  br i1 %arg, label %for.body2, label %for.end
 
 for.end:                                          ; preds = %if.end6, %for.body2
   ret void
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll b/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
index 07668616ff86d0..533b1f691f5adb 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p --version 5
 ; RUN: opt -passes='loop(simple-loop-unswitch<nontrivial>),verify<loops>' -simple-loop-unswitch-guards -S < %s | FileCheck %s
 ; RUN: opt -passes='simple-loop-unswitch<nontrivial>' -simple-loop-unswitch-guards -S < %s | FileCheck %s
 ; RUN: opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>),verify<loops>' -simple-loop-unswitch-guards  -verify-memoryssa -verify-loop-info -S < %s | FileCheck %s
@@ -131,30 +132,55 @@ exit:
   ret void
 }
 
-define void @test_nested_loop(i1 %cond, i32 %N) {
-; CHECK-LABEL: @test_nested_loop(
+define void @test_nested_loop(i1 %cond, i32 %N, i1 %arg) {
+; CHECK-LABEL: define void @test_nested_loop(i1 %cond, i32 %N, i1 %arg) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 [[COND:%.*]], label [[ENTRY_SPLIT:%.*]], label [[OUTER_LOOP_SPLIT:%.*]]
+; CHECK-NEXT:    br i1 %cond, label %entry.split, label %outer_loop.split
 ; CHECK:       entry.split:
-; CHECK-NEXT:    br label [[OUTER_LOOP:%.*]]
+; CHECK-NEXT:    br i1 %arg, label %entry.split.split.us, label %entry.split.split
+; CHECK:       entry.split.split.us:
+; CHECK-NEXT:    br label %outer_loop.us
+; CHECK:       outer_loop.us:
+; CHECK-NEXT:    br label %outer_loop.split.us.us
+; CHECK:       outer_backedge.us:
+; CHECK-NEXT:    br label %outer_loop.us
+; CHECK:       outer_loop.split.us.us:
+; CHECK-NEXT:    br label %loop.us.us
+; CHECK:       loop.us.us:
+; CHECK-NEXT:    %iv.us.us = phi i32 [ 0, %outer_loop.split.us.us ], [ %iv.next.us.us, %guarded.us.us ]
+; CHECK-NEXT:    br label %guarded.us.us
+; CHECK:       guarded.us.us:
+; CHECK-NEXT:    %iv.next.us.us = add i32 %iv.us.us, 1
+; CHECK-NEXT:    %loop.cond.us.us = icmp slt i32 %iv.next.us.us, %N
+; CHECK-NEXT:    br i1 %loop.cond.us.us, label %loop.us.us, label %outer_backedge.split.us.us
+; CHECK:       outer_backedge.split.us.us:
+; CHECK-NEXT:    br label %outer_backedge.us
+; CHECK:       entry.split.split:
+; CHECK-NEXT:    br label %outer_loop
 ; CHECK:       outer_loop:
-; CHECK-NEXT:    br label [[OUTER_LOOP_SPLIT_US:%.*]]
+; CHECK-NEXT:    br label %outer_loop.split.us
 ; CHECK:       outer_loop.split.us:
-; CHECK-NEXT:    br label [[LOOP_US:%.*]]
+; CHECK-NEXT:    br label %loop.us
 ; CHECK:       loop.us:
-; CHECK-NEXT:    [[IV_US:%.*]] = phi i32 [ 0, [[OUTER_LOOP_SPLIT_US]] ], [ [[IV_NEXT_US:%.*]], [[GUARDED_US:%.*]] ]
-; CHECK-NEXT:    br label [[GUARDED_US]]
+; CHECK-NEXT:    %iv.us = phi i32 [ 0, %outer_loop.split.us ], [ %iv.next.us, %guarded.us ]
+; CHECK-NEXT:    br label %guarded.us
 ; CHECK:       guarded.us:
-; CHECK-NEXT:    [[IV_NEXT_US]] = add i32 [[IV_US]], 1
-; CHECK-NEXT:    [[LOOP_COND_US:%.*]] = icmp slt i32 [[IV_NEXT_US]], [[N:%.*]]
-; CHECK-NEXT:    br i1 [[LOOP_COND_US]], label [[LOOP_US]], label [[OUTER_BACKEDGE_SPLIT_US:%.*]]
+; CHECK-NEXT:    %iv.next.us = add i32 %iv.us, 1
+; CHECK-NEXT:    %loop.cond.us = icmp slt i32 %iv.next.us, %N
+; CHECK-NEXT:    br i1 %loop.cond.us, label %loop.us, label %outer_backedge.split.us
 ; CHECK:       outer_backedge.split.us:
-; CHECK-NEXT:    br label [[OUTER_BACKEDGE:%.*]]
+; CHECK-NEXT:    br label %outer_backedge
+; CHECK:       outer_loop.split:
+; CHECK-NEXT:    br label %loop
+; CHECK:       loop:
+; CHECK-NEXT:    br label %deopt
 ; CHECK:       deopt:
 ; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 false) [ "deopt"() ]
 ; CHECK-NEXT:    unreachable
 ; CHECK:       outer_backedge:
-; CHECK-NEXT:    br i1 false, label [[OUTER_LOOP]], label [[EXIT:%.*]]
+; CHECK-NEXT:    br label %exit
+; CHECK:       exit:
+; CHECK-NEXT:    ret void
 ;
 
 entry:
@@ -171,7 +197,7 @@ loop:
   br i1 %loop.cond, label %loop, label %outer_backedge
 
 outer_backedge:
-  br i1 undef, label %outer_loop, label %exit
+  br i1 %arg, label %outer_loop, label %exit
 
 exit:
   ret void
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/pr37888.ll b/llvm/test/Transforms/SimpleLoopUnswitch/pr37888.ll
index 099d6a5456e8ea..7c9bb1b8520d63 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/pr37888.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/pr37888.ll
@@ -29,7 +29,7 @@ if.end:
   br label %for.inc
 
 for.inc:
-  br i1 undef, label %for.body, label %for.end
+  br i1 false, label %for.body, label %for.end
 
 for.end:
   ret void
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/preserve-analyses.ll b/llvm/test/Transforms/SimpleLoopUnswitch/preserve-analyses.ll
index d4544ba6f4a29a..7230bc75b012fb 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/preserve-analyses.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/preserve-analyses.ll
@@ -74,13 +74,13 @@ bb10:                                             ; preds = %bb8, %bb
 ; This is a simplified form of ineqn from above. It triggers some
 ; different cases in the loop-unswitch code.
 
-define void @simplified_ineqn() nounwind readonly {
+define void @simplified_ineqn(i1 %arg) nounwind readonly {
 entry:
   br label %bb8.outer
 
 bb8.outer:                                        ; preds = %bb6, %bb2, %entry
   %x = phi i32 [ 0, %entry ], [ 0, %bb6 ], [ 1, %bb2 ] ; <i32> [#uses=1]
-  br i1 undef, label %return, label %bb2
+  br i1 %arg, label %return, label %bb2
 
 bb2:                                              ; preds = %bb
   switch i32 %x, label %bb6 [
@@ -88,7 +88,7 @@ bb2:                                              ; preds = %bb
   ]
 
 bb6:                                              ; preds = %bb2
-  br i1 undef, label %bb8.outer, label %bb2
+  br i1 %arg, label %bb8.outer, label %bb2
 
 return:                                             ; preds = %bb8, %bb
   ret void
@@ -97,17 +97,17 @@ return:                                             ; preds = %bb8, %bb
 ; This function requires special handling to preserve LCSSA form.
 ; PR4934
 
-define void @pnp_check_irq() nounwind noredzone {
+define void @pnp_check_irq(i1 %arg) nounwind noredzone {
 entry:
   %conv56 = trunc i64 undef to i32                ; <i32> [#uses=1]
   br label %while.cond.i
 
 while.cond.i:                                     ; preds = %while.cond.i.backedge, %entry
   %call.i25 = call ptr @pci_get_device() nounwind noredzone ; <ptr> [#uses=2]
-  br i1 undef, label %if.then65, label %while.body.i
+  br i1 %arg, label %if.then65, label %while.body.i
 
 while.body.i:                                     ; preds = %while.cond.i
-  br i1 undef, label %if.then31.i.i, label %while.cond.i.backedge
+  br i1 %arg, label %if.then31.i.i, label %while.cond.i.backedge
 
 while.cond.i.backedge:                            ; preds = %if.then31.i.i, %while.body.i
   br label %while.cond.i

>From 5cd1e1e5a192ae67cf003855829545986df2324f Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 20:18:53 -0700
Subject: [PATCH 7/9] Remove br i1 undef in SimplifyCFG directory

---
 .../2004-12-10-SimplifyCFGCrash.ll            | 20 ++++++------
 .../SimplifyCFG/2006-06-12-InfLoop.ll         | 32 +++++++++----------
 .../Transforms/SimplifyCFG/branch-on-undef.ll |  6 ++--
 .../SimplifyCFG/fold-branch-to-common-dest.ll |  4 +--
 llvm/test/Transforms/SimplifyCFG/pr34131.ll   | 22 ++++++-------
 5 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/llvm/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll b/llvm/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll
index dbd8f7ab862d0d..0656811b39a9ea 100644
--- a/llvm/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll
+++ b/llvm/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll
@@ -1,36 +1,36 @@
 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
 
-define void @symhash_add() {
+define void @symhash_add(i1 %arg) {
 entry:
-	br i1 undef, label %then.0, label %UnifiedReturnBlock
+	br i1 %arg, label %then.0, label %UnifiedReturnBlock
 then.0:		; preds = %entry
-	br i1 undef, label %loopentry.2, label %loopentry.1.preheader
+	br i1 %arg, label %loopentry.2, label %loopentry.1.preheader
 loopentry.1.preheader:		; preds = %then.0
 	br label %loopentry.1.outer
 loopentry.1.outer:		; preds = %loopexit.1, %loopentry.1.preheader
 	br label %loopentry.1
 loopentry.1:		; preds = %endif.1, %then.4, %then.3, %then.1, %loopentry.1.outer
-	br i1 undef, label %loopexit.1, label %no_exit.1
+	br i1 %arg, label %loopexit.1, label %no_exit.1
 no_exit.1:		; preds = %loopentry.1
-	br i1 undef, label %then.1, label %else.0
+	br i1 %arg, label %then.1, label %else.0
 then.1:		; preds = %no_exit.1
 	br label %loopentry.1
 else.0:		; preds = %no_exit.1
-	br i1 undef, label %then.2, label %else.1
+	br i1 %arg, label %then.2, label %else.1
 then.2:		; preds = %else.0
-	br i1 undef, label %then.3, label %endif.1
+	br i1 %arg, label %then.3, label %endif.1
 then.3:		; preds = %then.2
 	br label %loopentry.1
 else.1:		; preds = %else.0
-	br i1 undef, label %endif.1, label %then.4
+	br i1 %arg, label %endif.1, label %then.4
 then.4:		; preds = %else.1
 	br label %loopentry.1
 endif.1:		; preds = %else.1, %then.2
 	br label %loopentry.1
 loopexit.1:		; preds = %loopentry.1
-	br i1 undef, label %loopentry.1.outer, label %loopentry.2
+	br i1 %arg, label %loopentry.1.outer, label %loopentry.2
 loopentry.2:		; preds = %no_exit.2, %loopexit.1, %then.0
-	br i1 undef, label %loopexit.2, label %no_exit.2
+	br i1 %arg, label %loopexit.2, label %no_exit.2
 no_exit.2:		; preds = %loopentry.2
 	br label %loopentry.2
 loopexit.2:		; preds = %loopentry.2
diff --git a/llvm/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll b/llvm/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
index 0ec88ed071fc2f..20c03e05ba0b97 100644
--- a/llvm/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
+++ b/llvm/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
 ; END.
 
-define void @main(i32 %c) {
+define void @main(i32 %c, i1 %arg) {
 entry:
 	%tmp.9 = icmp eq i32 %c, 2		; <i1> [#uses=1]
 	br i1 %tmp.9, label %endif.0, label %then.0
@@ -186,7 +186,7 @@ no_exit.0.i31.preheader:		; preds = %loopentry.1.i30
 no_exit.0.i31:		; preds = %loopexit.3.i, %no_exit.0.i31.preheader
 	br i1 false, label %then.1.i, label %else.0.i
 then.1.i:		; preds = %no_exit.0.i31
-	br i1 undef, label %then.0.i29, label %loopentry.0.i31
+	br i1 %arg, label %then.0.i29, label %loopentry.0.i31
 then.0.i29:		; preds = %then.1.i
 	unreachable
 loopentry.0.i31:		; preds = %then.1.i
@@ -194,13 +194,13 @@ loopentry.0.i31:		; preds = %then.1.i
 no_exit.0.i38.preheader:		; preds = %loopentry.0.i31
 	br label %no_exit.0.i38
 no_exit.0.i38:		; preds = %no_exit.0.i38, %no_exit.0.i38.preheader
-	br i1 undef, label %no_exit.0.i38, label %loopentry.1.i.preheader.loopexit
+	br i1 %arg, label %no_exit.0.i38, label %loopentry.1.i.preheader.loopexit
 loopentry.1.i.preheader.loopexit:		; preds = %no_exit.0.i38
 	br label %loopentry.1.i.preheader
 loopentry.1.i.preheader:		; preds = %loopentry.1.i.preheader.loopexit, %loopentry.0.i31
 	br label %loopentry.1.i
 loopentry.1.i:		; preds = %endif.2.i, %loopentry.1.i.preheader
-	br i1 undef, label %loopentry.2.i39.preheader, label %loopexit.1.i79.loopexit2
+	br i1 %arg, label %loopentry.2.i39.preheader, label %loopexit.1.i79.loopexit2
 loopentry.2.i39.preheader:		; preds = %loopentry.1.i
 	br label %loopentry.2.i39
 loopentry.2.i39:		; preds = %loopexit.5.i77, %loopentry.2.i39.preheader
@@ -212,45 +212,45 @@ loopentry.3.i40:		; preds = %loopexit.3.i51, %loopentry.3.i40.preheader
 no_exit.3.preheader.i42:		; preds = %loopentry.3.i40
 	br label %no_exit.3.i49
 no_exit.3.i49:		; preds = %no_exit.3.i49, %no_exit.3.preheader.i42
-	br i1 undef, label %no_exit.3.i49, label %loopexit.3.i51.loopexit
+	br i1 %arg, label %no_exit.3.i49, label %loopexit.3.i51.loopexit
 loopexit.3.i51.loopexit:		; preds = %no_exit.3.i49
 	br label %loopexit.3.i51
 loopexit.3.i51:		; preds = %loopexit.3.i51.loopexit, %loopentry.3.i40
-	br i1 undef, label %loopentry.3.i40, label %loopentry.4.i52
+	br i1 %arg, label %loopentry.3.i40, label %loopentry.4.i52
 loopentry.4.i52:		; preds = %loopexit.3.i51
 	br i1 false, label %no_exit.4.i54.preheader, label %hamming.exit.i71
 no_exit.4.i54.preheader:		; preds = %loopentry.4.i52
 	br label %no_exit.4.i54
 no_exit.4.i54:		; preds = %no_exit.4.backedge.i, %no_exit.4.i54.preheader
-	br i1 undef, label %then.1.i55, label %endif.1.i56
+	br i1 %arg, label %then.1.i55, label %endif.1.i56
 then.1.i55:		; preds = %no_exit.4.i54
-	br i1 undef, label %no_exit.4.backedge.i, label %loopexit.4.i57
+	br i1 %arg, label %no_exit.4.backedge.i, label %loopexit.4.i57
 no_exit.4.backedge.i:		; preds = %endif.1.i56, %then.1.i55
 	br label %no_exit.4.i54
 endif.1.i56:		; preds = %no_exit.4.i54
-	br i1 undef, label %no_exit.4.backedge.i, label %loopexit.4.i57
+	br i1 %arg, label %no_exit.4.backedge.i, label %loopexit.4.i57
 loopexit.4.i57:		; preds = %endif.1.i56, %then.1.i55
 	br i1 false, label %no_exit.i.i69.preheader, label %hamming.exit.i71
 no_exit.i.i69.preheader:		; preds = %loopexit.4.i57
 	br label %no_exit.i.i69
 no_exit.i.i69:		; preds = %no_exit.i.i69, %no_exit.i.i69.preheader
-	br i1 undef, label %no_exit.i.i69, label %hamming.exit.i71.loopexit
+	br i1 %arg, label %no_exit.i.i69, label %hamming.exit.i71.loopexit
 hamming.exit.i71.loopexit:		; preds = %no_exit.i.i69
 	br label %hamming.exit.i71
 hamming.exit.i71:		; preds = %hamming.exit.i71.loopexit, %loopexit.4.i57, %loopentry.4.i52, %loopentry.2.i39
-	br i1 undef, label %endif.2.i, label %loopentry.5.i72
+	br i1 %arg, label %endif.2.i, label %loopentry.5.i72
 loopentry.5.i72:		; preds = %hamming.exit.i71
 	br i1 false, label %shortcirc_next.i74.preheader, label %loopexit.5.i77
 shortcirc_next.i74.preheader:		; preds = %loopentry.5.i72
 	br label %shortcirc_next.i74
 shortcirc_next.i74:		; preds = %no_exit.5.i76, %shortcirc_next.i74.preheader
-	br i1 undef, label %no_exit.5.i76, label %loopexit.5.i77.loopexit
+	br i1 %arg, label %no_exit.5.i76, label %loopexit.5.i77.loopexit
 no_exit.5.i76:		; preds = %shortcirc_next.i74
-	br i1 undef, label %shortcirc_next.i74, label %loopexit.5.i77.loopexit
+	br i1 %arg, label %shortcirc_next.i74, label %loopexit.5.i77.loopexit
 loopexit.5.i77.loopexit:		; preds = %no_exit.5.i76, %shortcirc_next.i74
 	br label %loopexit.5.i77
 loopexit.5.i77:		; preds = %loopexit.5.i77.loopexit, %loopentry.5.i72
-	br i1 undef, label %loopentry.2.i39, label %loopexit.1.i79.loopexit
+	br i1 %arg, label %loopentry.2.i39, label %loopexit.1.i79.loopexit
 endif.2.i:		; preds = %hamming.exit.i71
 	br label %loopentry.1.i
 loopexit.1.i79.loopexit:		; preds = %loopexit.5.i77
@@ -258,7 +258,7 @@ loopexit.1.i79.loopexit:		; preds = %loopexit.5.i77
 loopexit.1.i79.loopexit2:		; preds = %loopentry.1.i
 	br label %loopexit.1.i79
 loopexit.1.i79:		; preds = %loopexit.1.i79.loopexit2, %loopexit.1.i79.loopexit
-	br i1 undef, label %then.3.i, label %loopentry.6.i80
+	br i1 %arg, label %then.3.i, label %loopentry.6.i80
 then.3.i:		; preds = %loopexit.1.i79
 	br i1 false, label %no_exit.6.i82.preheader, label %run.exit
 loopentry.6.i80:		; preds = %loopexit.1.i79
@@ -266,7 +266,7 @@ loopentry.6.i80:		; preds = %loopexit.1.i79
 no_exit.6.i82.preheader:		; preds = %loopentry.6.i80, %then.3.i
 	br label %no_exit.6.i82
 no_exit.6.i82:		; preds = %no_exit.6.i82, %no_exit.6.i82.preheader
-	br i1 undef, label %no_exit.6.i82, label %run.exit.loopexit
+	br i1 %arg, label %no_exit.6.i82, label %run.exit.loopexit
 run.exit.loopexit:		; preds = %no_exit.6.i82
 	br label %run.exit
 run.exit:		; preds = %run.exit.loopexit, %loopentry.6.i80, %then.3.i
diff --git a/llvm/test/Transforms/SimplifyCFG/branch-on-undef.ll b/llvm/test/Transforms/SimplifyCFG/branch-on-undef.ll
index bc42ae60730a7a..582a38f4af12fb 100644
--- a/llvm/test/Transforms/SimplifyCFG/branch-on-undef.ll
+++ b/llvm/test/Transforms/SimplifyCFG/branch-on-undef.ll
@@ -3,10 +3,10 @@
 
 declare void @foo(i32)
 
-define void @br_undef_simple() {
+define void @br_undef_simple(i1 %arg) {
 ; CHECK-LABEL: @br_undef_simple(
 ; CHECK-NEXT:    call void @foo(i32 0)
-; CHECK-NEXT:    br i1 undef, label [[IF:%.*]], label [[ELSE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF:%.*]], label [[ELSE:%.*]]
 ; CHECK:       common.ret:
 ; CHECK-NEXT:    ret void
 ; CHECK:       if:
@@ -17,7 +17,7 @@ define void @br_undef_simple() {
 ; CHECK-NEXT:    br label [[COMMON_RET]]
 ;
   call void @foo(i32 0)
-  br i1 undef, label %if, label %else
+  br i1 %arg, label %if, label %else
 
 if:
   call void @foo(i32 1)
diff --git a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
index bd63e6658c9a61..9fb5164d44d459 100644
--- a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
+++ b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
@@ -939,7 +939,7 @@ if.end.loopexit:
 }
 
 @f.b = external global i8, align 1
-define void @pr48450_3() {
+define void @pr48450_3(i1 %arg) {
 ; CHECK-LABEL: @pr48450_3(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_COND1:%.*]]
@@ -979,7 +979,7 @@ for.cond.cleanup:
   br label %cleanup
 
 for.body4:
-  br i1 undef, label %if.then6, label %if.end7
+  br i1 %arg, label %if.then6, label %if.end7
 
 if.then6:
   br label %cleanup
diff --git a/llvm/test/Transforms/SimplifyCFG/pr34131.ll b/llvm/test/Transforms/SimplifyCFG/pr34131.ll
index 89415cc88aeb1c..ed37a969aa47fa 100644
--- a/llvm/test/Transforms/SimplifyCFG/pr34131.ll
+++ b/llvm/test/Transforms/SimplifyCFG/pr34131.ll
@@ -4,7 +4,7 @@
 ; Earlier version using auto-generated checks from utils/update_test_checks.py
 ; had bot problems though...
 
-define void @patatino() {
+define void @patatino(i1 %arg) {
 
 ; CHECK-LABEL: @patatino
 
@@ -12,16 +12,16 @@ define void @patatino() {
 bb1:                                              ; preds = %bb36, %0
   br label %bb2
 bb2:                                              ; preds = %bb3, %bb1
-  br i1 undef, label %bb4, label %bb3
+  br i1 %arg, label %bb4, label %bb3
 bb3:                                              ; preds = %bb4, %bb2
-  br i1 undef, label %bb2, label %bb5
+  br i1 %arg, label %bb2, label %bb5
 bb4:                                              ; preds = %bb2
   switch i32 undef, label %bb3 [
   ]
 bb5:                                              ; preds = %bb3
   br label %bb6
 bb6:                                              ; preds = %bb5
-  br i1 undef, label %bb7, label %bb9
+  br i1 %arg, label %bb7, label %bb9
 bb7:                                              ; preds = %bb6
   %tmp = or i64 undef, 1
   %tmp8 = icmp ult i64 %tmp, 0
@@ -58,17 +58,17 @@ bb27:                                             ; preds = %bb24
   %tmp29 = icmp ult i64 %tmp28, 0
   br i1 %tmp29, label %bb30, label %bb9
 bb30:                                             ; preds = %bb27
-  br i1 undef, label %bb31, label %bb9
+  br i1 %arg, label %bb31, label %bb9
 bb31:                                             ; preds = %bb30
-  br i1 undef, label %bb32, label %bb9
+  br i1 %arg, label %bb32, label %bb9
 bb32:                                             ; preds = %bb31
-  br i1 undef, label %bb33, label %bb9
+  br i1 %arg, label %bb33, label %bb9
 bb33:                                             ; preds = %bb32
-  br i1 undef, label %bb34, label %bb9
+  br i1 %arg, label %bb34, label %bb9
 bb34:                                             ; preds = %bb33
-  br i1 undef, label %bb35, label %bb9
+  br i1 %arg, label %bb35, label %bb9
 bb35:                                             ; preds = %bb34
-  br i1 undef, label %bb36, label %bb9
+  br i1 %arg, label %bb36, label %bb9
 bb36:                                             ; preds = %bb35
-  br i1 undef, label %bb1, label %bb10
+  br i1 %arg, label %bb1, label %bb10
 }

>From 71ffa902b66e56d6277e03d3de2f0107351251fe Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 20:28:54 -0700
Subject: [PATCH 8/9] Remove br i1 undef in remaining Transforms directory

---
 llvm/test/Transforms/Sink/dead-user.ll        | 27 +++++++++--------
 .../SpeculativeExecution/PR46267.ll           |  4 +--
 .../StructurizeCFG/loop-continue-phi.ll       | 29 ++++++++++---------
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/llvm/test/Transforms/Sink/dead-user.ll b/llvm/test/Transforms/Sink/dead-user.ll
index 91e61b43ca3912..23e1b266adaf14 100644
--- a/llvm/test/Transforms/Sink/dead-user.ll
+++ b/llvm/test/Transforms/Sink/dead-user.ll
@@ -1,28 +1,27 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p --version 3
 ; Compiler should not be broken with a dead user.
 ; RUN: opt -passes=sink -S < %s | FileCheck %s
 
-define void @test(i16 %p1) {
-; CHECK-LABEL: define void @test(
-; CHECK-SAME: i16 [[P1:%.*]]) {
+define void @test(i16 %p1, i1 %arg) {
+; CHECK-LABEL: define void @test(i16 %p1, i1 %arg) {
 ; CHECK-NEXT:  bb.0:
-; CHECK-NEXT:    [[CONV:%.*]] = sext i16 [[P1]] to i32
-; CHECK-NEXT:    br i1 undef, label [[BB_1:%.*]], label [[BB_3:%.*]]
+; CHECK-NEXT:    %conv = sext i16 %p1 to i32
+; CHECK-NEXT:    br i1 %arg, label %bb.1, label %bb.3
 ; CHECK:       bb.1:
-; CHECK-NEXT:    br label [[BB_2:%.*]]
+; CHECK-NEXT:    br label %bb.2
 ; CHECK:       bb.2:
-; CHECK-NEXT:    [[AND_2:%.*]] = and i32 undef, [[CONV]]
-; CHECK-NEXT:    br label [[BB_2]]
+; CHECK-NEXT:    %and.2 = and i32 undef, %conv
+; CHECK-NEXT:    br label %bb.2
 ; CHECK:       bb.3:
-; CHECK-NEXT:    [[AND_3:%.*]] = and i32 undef, [[CONV]]
-; CHECK-NEXT:    br label [[BB_3]]
+; CHECK-NEXT:    %and.3 = and i32 undef, %conv
+; CHECK-NEXT:    br label %bb.3
 ; CHECK:       dead:
-; CHECK-NEXT:    [[AND_DEAD:%.*]] = and i32 undef, [[CONV]]
-; CHECK-NEXT:    br label [[DEAD:%.*]]
+; CHECK-NEXT:    %and.dead = and i32 undef, %conv
+; CHECK-NEXT:    br label %dead
 ;
 bb.0:
   %conv = sext i16 %p1 to i32
-  br i1 undef, label %bb.1, label %bb.3
+  br i1 %arg, label %bb.1, label %bb.3
 
 bb.1:                                             ; preds = %bb.0
   br label %bb.2
diff --git a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll
index 8f82a16639744d..5ee9fda470d1e7 100644
--- a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll
+++ b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll
@@ -27,11 +27,11 @@ end:                                 ; preds = %notnull, %entry
   ret ptr %i6
 }
 
-define void @f(i32 %i) {
+define void @f(i32 %i, i1 %arg) {
 entry:
 ; CHECK-LABEL: @f(
 ; CHECK:  %a2 = add i32 %i, 0
-  br i1 undef, label %land.rhs, label %land.end
+  br i1 %arg, label %land.rhs, label %land.end
 
 land.rhs:                                         ; preds = %entry
 ; CHECK: land.rhs:
diff --git a/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll b/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll
index 364eb161e298aa..a151d509be019f 100644
--- a/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll
+++ b/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll
@@ -1,24 +1,25 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p
 ; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
 
-define void @test1() {
+define void @test1(i1 %arg) {
 ; CHECK-LABEL: @test1(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br label [[LOOP:%.*]]
+; CHECK-NEXT:    %arg.inv = xor i1 %arg, true
+; CHECK-NEXT:    br label %loop
 ; CHECK:       Flow:
-; CHECK-NEXT:    br label [[FLOW1:%.*]]
+; CHECK-NEXT:    br label %Flow1
 ; CHECK:       loop:
-; CHECK-NEXT:    [[CTR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[TMP0:%.*]], [[FLOW1]] ]
-; CHECK-NEXT:    [[CTR_NEXT:%.*]] = add i32 [[CTR]], 1
-; CHECK-NEXT:    br i1 undef, label [[LOOP_A:%.*]], label [[FLOW1]]
+; CHECK-NEXT:    %ctr = phi i32 [ 0, %entry ], [ %0, %Flow1 ]
+; CHECK-NEXT:    %ctr.next = add i32 %ctr, 1
+; CHECK-NEXT:    br i1 %arg.inv, label %loop.a, label %Flow1
 ; CHECK:       loop.a:
-; CHECK-NEXT:    br i1 undef, label [[LOOP_B:%.*]], label [[FLOW:%.*]]
+; CHECK-NEXT:    br i1 %arg.inv, label %loop.b, label %Flow
 ; CHECK:       loop.b:
-; CHECK-NEXT:    br label [[FLOW]]
+; CHECK-NEXT:    br label %Flow
 ; CHECK:       Flow1:
-; CHECK-NEXT:    [[TMP0]] = phi i32 [ [[CTR_NEXT]], [[FLOW]] ], [ undef, [[LOOP]] ]
-; CHECK-NEXT:    [[TMP1:%.*]] = phi i1 [ false, [[FLOW]] ], [ true, [[LOOP]] ]
-; CHECK-NEXT:    br i1 [[TMP1]], label [[EXIT:%.*]], label [[LOOP]]
+; CHECK-NEXT:    %0 = phi i32 [ %ctr.next, %Flow ], [ undef, %loop ]
+; CHECK-NEXT:    %1 = phi i1 [ false, %Flow ], [ true, %loop ]
+; CHECK-NEXT:    br i1 %1, label %exit, label %loop
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret void
 ;
@@ -28,10 +29,10 @@ entry:
 loop:
   %ctr = phi i32 [ 0, %entry ], [ %ctr.next, %loop.a ], [ %ctr.next, %loop.b ]
   %ctr.next = add i32 %ctr, 1
-  br i1 undef, label %exit, label %loop.a
+  br i1 %arg, label %exit, label %loop.a
 
 loop.a:
-  br i1 undef, label %loop, label %loop.b
+  br i1 %arg, label %loop, label %loop.b
 
 loop.b:
   br label %loop

>From fff79ffacebbaa9a8ecd3cd3200b699eb1c8513c Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 2 Dec 2024 20:48:05 -0700
Subject: [PATCH 9/9] Remove unused arguments

---
 llvm/test/Transforms/SCCP/switch-constantfold-crash.ll | 10 ++++------
 .../SimpleLoopUnswitch/delete-dead-blocks.ll           |  2 +-
 llvm/test/Transforms/Sink/dead-user.ll                 |  2 +-
 .../Transforms/StructurizeCFG/loop-continue-phi.ll     |  2 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll b/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
index b163d2c078ef69..73eef205adae75 100644
--- a/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
+++ b/llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
@@ -2,9 +2,8 @@
 ; RUN: opt -passes=ipsccp < %s -S | FileCheck %s
 ; RUN: opt -passes='ipsccp,ipsccp' < %s -S | FileCheck %s
 
-define void @barney(i1 %arg) {
-; CHECK-LABEL: define {{[^@]+}}@barney
-; CHECK-SAME: (i1 [[ARG:%.*]]) {
+define void @barney() {
+; CHECK-LABEL: define {{[^@]+}}@barney() {
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB9:%.*]]
 ; CHECK:       bb6:
@@ -27,9 +26,8 @@ bb9:                                              ; preds = %bb
   ]
 }
 
-define void @blam(i1 %arg) {
-; CHECK-LABEL: define {{[^@]+}}@blam
-; CHECK-SAME: (i1 [[ARG:%.*]]) {
+define void @blam() {
+; CHECK-LABEL: define {{[^@]+}}@blam() {
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB16:%.*]]
 ; CHECK:       bb16:
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll b/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
index e66c7ace18fc05..c120eeb440d193 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
@@ -6,7 +6,7 @@
 declare void @foo()
 
 ; CHECK-LABEL: @Test
-define void @Test(i32, i1 %arg) {
+define void @Test(i32) {
 entry:
   br label %outer
 outer:
diff --git a/llvm/test/Transforms/Sink/dead-user.ll b/llvm/test/Transforms/Sink/dead-user.ll
index 23e1b266adaf14..e63aa027a2db81 100644
--- a/llvm/test/Transforms/Sink/dead-user.ll
+++ b/llvm/test/Transforms/Sink/dead-user.ll
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p --version 3
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
 ; Compiler should not be broken with a dead user.
 ; RUN: opt -passes=sink -S < %s | FileCheck %s
 
diff --git a/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll b/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll
index a151d509be019f..eec67e67b540dc 100644
--- a/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll
+++ b/llvm/test/Transforms/StructurizeCFG/loop-continue-phi.ll
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
 
 define void @test1(i1 %arg) {



More information about the llvm-commits mailing list