Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm] Remove br i1 undef from regression tests #117292

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

leewei05
Copy link
Contributor

This PR removes tests with br i1 undef under llvm/tests/Transforms/MemCpyOpt, MergedLoadStoreMotion, NewGVN.
I've observed thatNewGVN pass will create a store poison instruction for unreachable basic block.

// Now insert something that simplifycfg will turn into an unreachable.
Type *Int8Ty = Type::getInt8Ty(BB->getContext());
new StoreInst(
PoisonValue::get(Int8Ty),
Constant::getNullValue(PointerType::getUnqual(BB->getContext())),
BB->getTerminator()->getIterator());
}

@nunoplopes @regehr

@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Lee Wei (leewei05)

Changes

This PR removes tests with br i1 undef under llvm/tests/Transforms/MemCpyOpt, MergedLoadStoreMotion, NewGVN.
I've observed thatNewGVN pass will create a store poison instruction for unreachable basic block.

// Now insert something that simplifycfg will turn into an unreachable.
Type *Int8Ty = Type::getInt8Ty(BB->getContext());
new StoreInst(
PoisonValue::get(Int8Ty),
Constant::getNullValue(PointerType::getUnqual(BB->getContext())),
BB->getTerminator()->getIterator());
}

@nunoplopes @regehr


Patch is 91.16 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/117292.diff

39 Files Affected:

  • (modified) llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll (+5-5)
  • (modified) llvm/test/Transforms/MergedLoadStoreMotion/st_sink_debuginvariant.ll (+2-2)
  • (modified) llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll (+13-10)
  • (modified) llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll (+4-4)
  • (modified) llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll (+11-11)
  • (modified) llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll (+10-10)
  • (modified) llvm/test/Transforms/NewGVN/completeness.ll (+9-9)
  • (modified) llvm/test/Transforms/NewGVN/crash.ll (+12-12)
  • (modified) llvm/test/Transforms/NewGVN/deadstore.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/eliminate-ssacopy.ll (+9-12)
  • (modified) llvm/test/Transforms/NewGVN/metadata-nonnull.ll (+20-20)
  • (modified) llvm/test/Transforms/NewGVN/phi-of-ops-move-block.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/phi-of-ops-simplification-dependencies.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/pr25440.ll (+25-23)
  • (modified) llvm/test/Transforms/NewGVN/pr31594.ll (+6-5)
  • (modified) llvm/test/Transforms/NewGVN/pr31613.ll (+8-7)
  • (modified) llvm/test/Transforms/NewGVN/pr31682.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/pr32403.ll (+11-8)
  • (modified) llvm/test/Transforms/NewGVN/pr32838.ll (+20-21)
  • (modified) llvm/test/Transforms/NewGVN/pr32845.ll (+6-7)
  • (modified) llvm/test/Transforms/NewGVN/pr32897.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/pr32934.ll (+4-4)
  • (modified) llvm/test/Transforms/NewGVN/pr33014.ll (+6-6)
  • (modified) llvm/test/Transforms/NewGVN/pr33086.ll (+4-4)
  • (modified) llvm/test/Transforms/NewGVN/pr33116.ll (+5-5)
  • (modified) llvm/test/Transforms/NewGVN/pr33187.ll (+15-15)
  • (modified) llvm/test/Transforms/NewGVN/pr33204.ll (+5-5)
  • (modified) llvm/test/Transforms/NewGVN/pr33432.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/pr33720.ll (+7-7)
  • (modified) llvm/test/Transforms/NewGVN/pr34430.ll (+5-5)
  • (modified) llvm/test/Transforms/NewGVN/pr35074.ll (+3-3)
  • (modified) llvm/test/Transforms/NewGVN/pr42422-phi-of-ops.ll (+13-17)
  • (modified) llvm/test/Transforms/NewGVN/pr43441.ll (+10-6)
  • (modified) llvm/test/Transforms/NewGVN/pre-new-inst-xfail.ll (+2-2)
  • (modified) llvm/test/Transforms/NewGVN/predicates.ll (+4-5)
  • (modified) llvm/test/Transforms/NewGVN/refine-stores.ll (+14-14)
  • (modified) llvm/test/Transforms/NewGVN/stale-loop-info.ll (+4-3)
  • (modified) llvm/test/Transforms/NewGVN/unreachable_block_infinite_loop.ll (+4-4)
diff --git a/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll b/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
index 80fa9b124e59d4..1b997e8c4f884a 100644
--- a/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
+++ b/llvm/test/Transforms/MemCpyOpt/aa-recursion-assertion-failure.ll
@@ -6,7 +6,7 @@ source_filename = "test.cpp"
 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
 target triple = "aarch64-unknown-linux-android21"
 
-define dso_local void @_Z1ml(i64 %e) {
+define dso_local void @_Z1ml(i64 %e, i1 %arg) {
 ; CHECK-LABEL: @_Z1ml(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[L:%.*]] = alloca i8, align 1
@@ -20,7 +20,7 @@ define dso_local void @_Z1ml(i64 %e) {
 ; CHECK:       while.cond:
 ; CHECK-NEXT:    [[TMP1]] = phi ptr [ [[L]], [[ENTRY:%.*]] ], [ [[TMP0]], [[WHILE_COND_LOOPEXIT]] ]
 ; CHECK-NEXT:    [[I_0]] = phi ptr [ [[L]], [[ENTRY]] ], [ [[I_1_LCSSA]], [[WHILE_COND_LOOPEXIT]] ]
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY_LR_PH:%.*]], label [[WHILE_COND_LOOPEXIT]]
+; CHECK-NEXT:    br i1 [[ARG:%.*]], label [[FOR_BODY_LR_PH:%.*]], label [[WHILE_COND_LOOPEXIT]]
 ; CHECK:       for.body.lr.ph:
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
@@ -32,7 +32,7 @@ define dso_local void @_Z1ml(i64 %e) {
 ; CHECK-NEXT:    store i8 [[TMP4]], ptr [[TMP2]], align 1
 ; CHECK-NEXT:    br label [[_Z1DPCS_L_EXIT:%.*]]
 ; CHECK:       _Z1dPcS_l.exit:
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN3:%.*]], label [[IF_END5]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[IF_THEN3:%.*]], label [[IF_END5]]
 ; CHECK:       if.then3:
 ; CHECK-NEXT:    [[ADD_PTR4:%.*]] = getelementptr inbounds i8, ptr [[I_15]], i64 [[E]]
 ; CHECK-NEXT:    br label [[IF_END5]]
@@ -55,7 +55,7 @@ while.cond.loopexit:                              ; preds = %while.cond, %for.co
 while.cond:                                       ; preds = %while.cond.loopexit, %entry
   %1 = phi ptr [ %l, %entry ], [ %0, %while.cond.loopexit ]
   %i.0 = phi ptr [ %l, %entry ], [ %i.1.lcssa, %while.cond.loopexit ]
-  br i1 undef, label %for.body.lr.ph, label %while.cond.loopexit
+  br i1 %arg, label %for.body.lr.ph, label %while.cond.loopexit
 
 for.body.lr.ph:                                   ; preds = %while.cond
   br label %for.body
@@ -70,7 +70,7 @@ for.body:                                         ; preds = %if.end5, %for.body.
   br label %_Z1dPcS_l.exit
 
 _Z1dPcS_l.exit:                                   ; preds = %for.body
-  br i1 undef, label %if.then3, label %if.end5
+  br i1 %arg, label %if.then3, label %if.end5
 
 if.then3:                                         ; preds = %_Z1dPcS_l.exit
   %add.ptr4 = getelementptr inbounds i8, ptr %i.15, i64 %e
diff --git a/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_debuginvariant.ll b/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_debuginvariant.ll
index a9373fab22ca77..86cf7117b6da10 100644
--- a/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_debuginvariant.ll
+++ b/llvm/test/Transforms/MergedLoadStoreMotion/st_sink_debuginvariant.ll
@@ -18,9 +18,9 @@
 @g_173 = dso_local local_unnamed_addr global i16 0, !dbg !0
 
 ; Function Attrs: noinline norecurse nounwind
-define dso_local void @func_34(ptr noalias sret(%struct.S0) %agg.result) local_unnamed_addr #0 !dbg !11 {
+define dso_local void @func_34(ptr noalias sret(%struct.S0) %agg.result, i1 %arg) local_unnamed_addr #0 !dbg !11 {
 entry:
-  br i1 undef, label %if.end, label %if.then, !dbg !18
+  br i1 %arg, label %if.end, label %if.then, !dbg !18
 
 if.then:                                          ; preds = %entry
   call void @llvm.dbg.value(metadata i16 5, metadata !19, metadata !DIExpression()), !dbg !22
diff --git a/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll b/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll
index c6fc7b99cdf8df..14a16a05e74ae7 100644
--- a/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll
+++ b/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll
@@ -4,42 +4,45 @@
 ; CHECK-NOT: load
 ; CHECK-NOT: phi
 
-define ptr @cat(ptr %s1, ...) nounwind {
+define ptr @cat(ptr %s1, i1 %arg, ...) nounwind {
 ; CHECK-LABEL: define ptr @cat(
-; CHECK-SAME: ptr [[S1:%.*]], ...) #[[ATTR0:[0-9]+]] {
+; CHECK-SAME: ptr [[S1:%.*]], i1 [[ARG:%.*]], ...) #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 undef, label [[BB:%.*]], label [[BB3:%.*]]
+; CHECK-NEXT:    br i1 false, label [[BB:%.*]], label [[BB3:%.*]]
 ; CHECK:       bb:
+; CHECK-NEXT:    store i8 poison, ptr null, align 1
 ; CHECK-NEXT:    unreachable
 ; CHECK:       bb3:
 ; CHECK-NEXT:    store ptr undef, ptr undef, align 4
-; CHECK-NEXT:    br i1 undef, label [[BB5:%.*]], label [[BB6:%.*]]
+; CHECK-NEXT:    br i1 false, label [[BB5:%.*]], label [[BB6:%.*]]
 ; CHECK:       bb5:
+; CHECK-NEXT:    store i8 poison, ptr null, align 1
 ; CHECK-NEXT:    unreachable
 ; CHECK:       bb6:
 ; CHECK-NEXT:    br label [[BB12:%.*]]
 ; CHECK:       bb8:
-; CHECK-NEXT:    br i1 undef, label [[BB9:%.*]], label [[BB10:%.*]]
+; CHECK-NEXT:    br i1 true, label [[BB9:%.*]], label [[BB10:%.*]]
 ; CHECK:       bb9:
 ; CHECK-NEXT:    br label [[BB11:%.*]]
 ; CHECK:       bb10:
+; CHECK-NEXT:    store i8 poison, ptr null, align 1
 ; CHECK-NEXT:    br label [[BB11]]
 ; CHECK:       bb11:
 ; CHECK-NEXT:    br label [[BB12]]
 ; CHECK:       bb12:
-; CHECK-NEXT:    br i1 undef, label [[BB8:%.*]], label [[BB13:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[BB8:%.*]], label [[BB13:%.*]]
 ; CHECK:       bb13:
 ; CHECK-NEXT:    ret ptr undef
 ;
 entry:
-  br i1 undef, label %bb, label %bb3
+  br i1 false, label %bb, label %bb3
 
 bb:                                               ; preds = %entry
   unreachable
 
 bb3:                                              ; preds = %entry
   store ptr undef, ptr undef, align 4
-  br i1 undef, label %bb5, label %bb6
+  br i1 false, label %bb5, label %bb6
 
 bb5:                                              ; preds = %bb3
   unreachable
@@ -48,7 +51,7 @@ bb6:                                              ; preds = %bb3
   br label %bb12
 
 bb8:                                              ; preds = %bb12
-  br i1 undef, label %bb9, label %bb10
+  br i1 %arg, label %bb9, label %bb10
 
 bb9:                                              ; preds = %bb8
   %0 = load ptr, ptr undef, align 4                   ; <ptr> [#uses=0]
@@ -62,7 +65,7 @@ bb11:                                             ; preds = %bb10, %bb9
   br label %bb12
 
 bb12:                                             ; preds = %bb11, %bb6
-  br i1 undef, label %bb8, label %bb13
+  br i1 %arg, label %bb8, label %bb13
 
 bb13:                                             ; preds = %bb12
   ret ptr undef
diff --git a/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll b/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll
index 0a121ffab761f4..ebc89c5c5489aa 100644
--- a/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll
+++ b/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll
@@ -5,11 +5,11 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-define i32 @main(i32 %argc, ptr nocapture %argv) personality ptr @__gxx_personality_v0 {
+define i32 @main(i32 %argc, ptr nocapture %argv, i1 %arg, i32 %arg2) personality ptr @__gxx_personality_v0 {
 entry:
   %0 = getelementptr inbounds i8, ptr undef, i64 5    ; <ptr> [#uses=1]
   store i32 undef, ptr %0, align 1
-  br i1 undef, label %k121.i.i, label %l117.i.i
+  br i1 %arg, label %k121.i.i, label %l117.i.i
 
 l117.i.i:                                         ; preds = %entry
   invoke fastcc void @foo()
@@ -19,7 +19,7 @@ l117.i.i:                                         ; preds = %entry
   unreachable
 
 k121.i.i:                                         ; preds = %entry
-  br i1 undef, label %l129.i.i, label %k133.i.i
+  br i1 %arg, label %l129.i.i, label %k133.i.i
 
 l129.i.i:                                         ; preds = %k121.i.i
   invoke fastcc void @foo()
@@ -46,7 +46,7 @@ k151.i.i:                                         ; preds = %k133.i.i
 landing_pad:                                      ; preds = %l147.i.i, %l129.i.i, %l117.i.i
   %exn = landingpad {ptr, i32}
   cleanup
-  switch i32 undef, label %fin [
+  switch i32 %arg2, label %fin [
   i32 1, label %catch1
   i32 2, label %catch
   ]
diff --git a/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll b/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll
index c039422be84ed1..31b674d03b5e27 100644
--- a/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll
+++ b/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll
@@ -5,12 +5,12 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
 
 @nuls = external global [10 x i8]
 
-define fastcc void @p_ere() nounwind {
+define fastcc void @p_ere(i1 %arg, i32 %arg2) nounwind {
 entry:
   br label %"<bb 5>"
 
 "<L18>.i":
-  br i1 undef, label %"<bb 3>.i30.i", label %doemit.exit51.i
+  br i1 %arg, label %"<bb 3>.i30.i", label %doemit.exit51.i
 
 "<bb 3>.i30.i":
   unreachable
@@ -19,7 +19,7 @@ doemit.exit51.i:
   br label %"<bb 53>.i"
 
 "<L19>.i":
-  br i1 undef, label %"<bb 3>.i55.i", label %doemit.exit76.i
+  br i1 %arg, label %"<bb 3>.i55.i", label %doemit.exit76.i
 
 "<bb 3>.i55.i":
   unreachable
@@ -35,7 +35,7 @@ doemit.exit76.i:
   br label %"<bb 53>.i"
 
 "<L24>.i":
-  br i1 undef, label %"<bb 53>.i", label %"<bb 35>.i"
+  br i1 %arg, label %"<bb 53>.i", label %"<bb 35>.i"
 
 "<bb 35>.i":
   br label %"<bb 53>.i"
@@ -52,19 +52,19 @@ doemit.exit76.i:
 "<bb 53>.i":
   %wascaret_2.i = phi i32 [ 0, %"<L39>.i" ], [ 0, %"<L29>.i" ], [ 0, %"<L28>.i" ], [ 0, %"<bb 35>.i" ], [ 0, %"<L99>.i" ], [ 0, %"<L98>.i" ], [ 0, %doemit.exit76.i ], [ 1, %doemit.exit51.i ], [ 0, %"<L24>.i" ]
   %D.5496_84.i = load ptr, ptr undef, align 8
-  br i1 undef, label %"<bb 54>.i", label %"<bb 5>"
+  br i1 %arg, label %"<bb 54>.i", label %"<bb 5>"
 
 "<bb 54>.i":
-  br i1 undef, label %"<bb 5>", label %"<bb 58>.i"
+  br i1 %arg, label %"<bb 5>", label %"<bb 58>.i"
 
 "<bb 58>.i":
-  br i1 undef, label %"<bb 64>.i", label %"<bb 59>.i"
+  br i1 %arg, label %"<bb 64>.i", label %"<bb 59>.i"
 
 "<bb 59>.i":
   br label %"<bb 64>.i"
 
 "<bb 64>.i":
-  switch i32 undef, label %"<bb 5>" [
+  switch i32 %arg2, label %"<bb 5>" [
   i32 42, label %"<L54>.i"
   i32 43, label %"<L55>.i"
   i32 63, label %"<L56>.i"
@@ -72,7 +72,7 @@ doemit.exit76.i:
   ]
 
 "<L54>.i":
-  br i1 undef, label %"<bb 3>.i105.i", label %doemit.exit127.i
+  br i1 %arg, label %"<bb 3>.i105.i", label %doemit.exit127.i
 
 "<bb 3>.i105.i":
   unreachable
@@ -81,7 +81,7 @@ doemit.exit127.i:
   unreachable
 
 "<L55>.i":
-  br i1 undef, label %"<bb 3>.i157.i", label %"<bb 5>"
+  br i1 %arg, label %"<bb 3>.i157.i", label %"<bb 5>"
 
 "<bb 3>.i157.i":
   unreachable
@@ -93,7 +93,7 @@ doemit.exit127.i:
   unreachable
 
 "<bb 5>":
-  switch i32 undef, label %"<L39>.i" [
+  switch i32 %arg2, label %"<L39>.i" [
   i32 36, label %"<L19>.i"
   i32 94, label %"<L18>.i"
   i32 124, label %"<L98>.i"
diff --git a/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll b/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll
index 1357f2b809f748..3e7e9bdf2ce7d7 100644
--- a/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll
+++ b/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll
@@ -2,9 +2,9 @@
 ; RUN: opt < %s -passes=newgvn
 ; PR12858
 
-define void @fn5(i16 signext %p1, i8 signext %p2) nounwind uwtable {
+define void @fn5(i16 signext %p1, i8 signext %p2, i1 %arg) nounwind uwtable {
 entry:
-  br i1 undef, label %if.else, label %if.then
+  br i1 %arg, label %if.else, label %if.then
 
 if.then:                                          ; preds = %entry
   br label %if.end
@@ -15,7 +15,7 @@ if.else:                                          ; preds = %entry
 
 if.end:                                           ; preds = %if.else, %if.then
   %conv1 = sext i16 %p1 to i32
-  br i1 undef, label %if.then3, label %if.else4
+  br i1 %arg, label %if.then3, label %if.else4
 
 if.then3:                                         ; preds = %if.end
   br label %if.end12
diff --git a/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll b/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll
index 53190466963a19..1cf9fd90095642 100644
--- a/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll
+++ b/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll
@@ -242,21 +242,21 @@ bb23:                                             ; preds = %bb4
 ;; Both loads should equal 0, but it requires being
 ;; completely optimistic about MemoryPhis, otherwise
 ;; we will not be able to see through the cycle.
-define i8 @irreducible_memoryphi(ptr noalias %arg, ptr noalias %arg2) {
+define i8 @irreducible_memoryphi(ptr noalias %arg, ptr noalias %arg2, i1 %arg3) {
 ; CHECK-LABEL: @irreducible_memoryphi(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    store i8 0, ptr [[ARG:%.*]], align 1
-; CHECK-NEXT:    br i1 undef, label [[BB2:%.*]], label [[BB1:%.*]]
+; CHECK-NEXT:    br i1 [[ARG3:%.*]], label [[BB2:%.*]], label [[BB1:%.*]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    br label [[BB2]]
 ; CHECK:       bb2:
-; CHECK-NEXT:    br i1 undef, label [[BB1]], label [[BB3:%.*]]
+; CHECK-NEXT:    br i1 [[ARG3]], label [[BB1]], label [[BB3:%.*]]
 ; CHECK:       bb3:
 ; CHECK-NEXT:    ret i8 0
 ;
 bb:
   store i8 0, ptr %arg
-  br i1 undef, label %bb2, label %bb1
+  br i1 %arg3, label %bb2, label %bb1
 
 bb1:                                              ; preds = %bb2, %bb
   br label %bb2
@@ -264,7 +264,7 @@ bb1:                                              ; preds = %bb2, %bb
 bb2:                                              ; preds = %bb1, %bb
   %tmp2 = load i8, ptr %arg
   store i8 0, ptr %arg
-  br i1 undef, label %bb1, label %bb3
+  br i1 %arg3, label %bb1, label %bb3
 
 bb3:                                              ; preds = %bb2
   %tmp = load i8, ptr %arg
@@ -277,20 +277,20 @@ bb3:                                              ; preds = %bb2
 ;; It should return 0, but it requires being
 ;; completely optimistic about phis, otherwise
 ;; we will not be able to see through the cycle.
-define i32 @irreducible_phi(i32 %arg) {
+define i32 @irreducible_phi(i32 %arg, i1 %arg2) {
 ; CHECK-LABEL: @irreducible_phi(
 ; CHECK-NEXT:  bb:
-; CHECK-NEXT:    br i1 undef, label [[BB2:%.*]], label [[BB1:%.*]]
+; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB2:%.*]], label [[BB1:%.*]]
 ; CHECK:       bb1:
 ; CHECK-NEXT:    br label [[BB2]]
 ; CHECK:       bb2:
-; CHECK-NEXT:    br i1 undef, label [[BB1]], label [[BB3:%.*]]
+; CHECK-NEXT:    br i1 [[ARG2]], label [[BB1]], label [[BB3:%.*]]
 ; CHECK:       bb3:
 ; CHECK-NEXT:    ret i32 0
 ;
 bb:
   %tmp = add i32 0, %arg
-  br i1 undef, label %bb2, label %bb1
+  br i1 %arg2, label %bb2, label %bb1
 
 bb1:                                              ; preds = %bb2, %bb
   %phi1 = phi i32 [%tmp, %bb], [%phi2, %bb2]
@@ -298,7 +298,7 @@ bb1:                                              ; preds = %bb2, %bb
 
 bb2:                                              ; preds = %bb1, %bb
   %phi2 = phi i32 [%tmp, %bb], [%phi1, %bb1]
-  br i1 undef, label %bb1, label %bb3
+  br i1 %arg2, label %bb1, label %bb3
 
 bb3:                                              ; preds = %bb2
   ; This should be zero
diff --git a/llvm/test/Transforms/NewGVN/completeness.ll b/llvm/test/Transforms/NewGVN/completeness.ll
index 17592ffaf5d432..5585d2bf1e678f 100644
--- a/llvm/test/Transforms/NewGVN/completeness.ll
+++ b/llvm/test/Transforms/NewGVN/completeness.ll
@@ -386,12 +386,12 @@ bb1:                                              ; preds = %bb1, %bb
 
 ;; Make sure we handle the case where we later come up with an expression that we need
 ;; for a phi of ops.
-define void @test9() {
+define void @test9(i1 %arg) {
 ; CHECK-LABEL: @test9(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB1:%.*]]
 ; CHECK:       bb1:
-; CHECK-NEXT:    br i1 undef, label [[BB1]], label [[BB2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG:%.*]], label [[BB1]], label [[BB2:%.*]]
 ; CHECK:       bb2:
 ; CHECK-NEXT:    br label [[BB6:%.*]]
 ; CHECK:       bb6:
@@ -405,7 +405,7 @@ bb:
   br label %bb1
 
 bb1:                                              ; preds = %bb1, %bb
-  br i1 undef, label %bb1, label %bb2
+  br i1 %arg, label %bb1, label %bb2
 
 bb2:                                              ; preds = %bb1
   %tmp = select i1 true, i32 -14, i32 -10
@@ -426,7 +426,7 @@ bb6:                                              ; preds = %bb6, %bb2
 }
 
 ;; Ensure that we revisit predicateinfo operands at the right points in time.
-define void @test10() {
+define void @test10(i1 %arg) {
 ; CHECK-LABEL: @test10(
 ; CHECK-NEXT:  b:
 ; CHECK-NEXT:    br label [[G:%.*]]
@@ -436,7 +436,7 @@ define void @test10() {
 ; CHECK-NEXT:    [[J:%.*]] = icmp eq ptr [[H]], inttoptr (i64 32 to ptr)
 ; CHECK-NEXT:    br i1 [[J]], label [[C:%.*]], label [[I]]
 ; CHECK:       i:
-; CHECK-NEXT:    br i1 undef, label [[K:%.*]], label [[G]]
+; CHECK-NEXT:    br i1 [[ARG:%.*]], label [[K:%.*]], label [[G]]
 ; CHECK:       k:
 ; CHECK-NEXT:    br i1 false, label [[C]], label [[O:%.*]]
 ; CHECK:       o:
@@ -455,7 +455,7 @@ g:                                                ; preds = %i, %b
   br i1 %j, label %c, label %i
 
 i:                                                ; preds = %g
-  br i1 undef, label %k, label %g
+  br i1 %arg, label %k, label %g
 
 k:                                                ; preds = %i
   %l = icmp eq ptr %n, %m
@@ -470,10 +470,10 @@ c:                                                ; preds = %o, %k, %g
 }
 
 ;; Ensure we handle VariableExpression properly.
-define void @test11() {
+define void @test11(i1 %arg) {
 ; CHECK-LABEL: @test11(
 ; 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:    br label [[BB2]]
 ; CHECK:       bb2:
@@ -488,7 +488,7 @@ define void @test11() {
 ; CHECK-NEXT:    ret void
 ;
 bb:
-  br i1 undef, label %bb1, label %bb2
+  br i1 %arg, label %bb1, label %bb2
 
 bb1:                                              ; preds = %bb
   br label %bb2
diff --git a/llvm/test/Transforms/NewGVN/crash.ll b/llvm/test/Transforms/NewGVN/crash.ll
index 26eaa766a05434..02edc2ff8da7e2 100644
--- a/llvm/test/Transforms/NewGVN/crash.ll
+++ b/llvm/test/Transforms/NewGVN/crash.ll
@@ -6,9 +6,9 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10.0"
 
-define ptr @test1(ptr %name, i32 %namelen, ptr %o, i32 %expected_type) nounwind ssp {
+define ptr @test1(ptr %name, i32 %namelen, ptr %o, i32 %expected_type, i1 %arg) nounwind ssp {
 entry:
-  br i1 undef, label %if.end13, label %while.body.preheader
+  br i1 %arg, label %if.end13, label %while.body.preheader
 
 
 if.end13:                                         ; preds = %if.then6
@@ -23,25 +23,25 @@ while.body:                                       ; preds = %while.body.backedge
 
 lor.lhs.false:                                    ; preds = %while.body
   %tmp22 = load i32, ptr %o.addr.0                       ; <i32> [#uses=0]
-  br i1 undef, label %land.lhs.true24, label %if.end31
+  br i1 %arg, label %land.lhs.true24, label %if.end31
 
 land.lhs.true24:                                  ; preds = %lor.lhs.false
   %call28 = call ptr @parse_object(ptr undef) nounwind ; <ptr> [#uses=0]
-  br i1 undef, label %return.loopexit, label %if.end31
+  br i1 %arg, label %return.loopexit, label %if.end31
 
 if.end31:                                         ; preds = %land.lhs.true24, %lor.lhs.false
-  br i1 undef, label %return.loopexit, label %if.end41
+  br i1 %arg, label %return.loopexit, label %if.end41
 
 if.end41:                                         ; preds = %if.end31
   %tmp45 = load i32, ptr %o.addr.0                       ; <i32> [#uses=0]
-  br i1 undef, label %if.then50, label %if.else
+  br i1 %arg, label %if.then50, label %if.else
 
 if.then50:                                        ; preds = %if.end41
   %tmp53 = load ptr, ptr undef                       ; <ptr> [#uses=1]
   br label %while.body.backedge
 
 if.else:                                          ; preds = %if.end...
[truncated]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants