diff --git a/llvm/examples/IRTransforms/SimplifyCFG.cpp b/llvm/examples/IRTransforms/SimplifyCFG.cpp index 111d4538fae0..72c86fae6c50 100644 --- a/llvm/examples/IRTransforms/SimplifyCFG.cpp +++ b/llvm/examples/IRTransforms/SimplifyCFG.cpp @@ -81,11 +81,11 @@ static bool removeDeadBlocks_v1(Function &F) { // for (PHINode &PN : make_early_inc_range(Succ->phis())) // PN.removeIncomingValue(&BB); - // Replace all instructions in BB with an undef constant. The block is + // Replace all instructions in BB with a poison constant. The block is // unreachable, so the results of the instructions should never get used. while (!BB.empty()) { Instruction &I = BB.back(); - I.replaceAllUsesWith(UndefValue::get(I.getType())); + I.replaceAllUsesWith(PoisonValue::get(I.getType())); I.eraseFromParent(); } diff --git a/llvm/test/Examples/IRTransforms/SimplifyCFG/tut-simplify-cfg2-dead-block-order.ll b/llvm/test/Examples/IRTransforms/SimplifyCFG/tut-simplify-cfg2-dead-block-order.ll index e7769fe47a0d..550322ce7ed7 100644 --- a/llvm/test/Examples/IRTransforms/SimplifyCFG/tut-simplify-cfg2-dead-block-order.ll +++ b/llvm/test/Examples/IRTransforms/SimplifyCFG/tut-simplify-cfg2-dead-block-order.ll @@ -7,7 +7,6 @@ define i32 @remove_dead_blocks() { ; CHECK-LABEL: @remove_dead_blocks( ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i32 1 -; CHECK-NEXT: } ; entry: ret i32 1 @@ -25,7 +24,6 @@ define i32 @simp1() { ; CHECK-NEXT: ret i32 1 ; CHECK: bb.1: ; CHECK-NEXT: ret i32 2 -; CHECK-NEXT: } ; entry: ret i32 1 @@ -46,7 +44,6 @@ define i32 @remove_dead_block_with_phi() { ; CHECK-NEXT: br label [[BB_2:%.*]] ; CHECK: bb.2: ; CHECK-NEXT: ret i32 1 -; CHECK-NEXT: } ; entry: br label %bb.2 @@ -63,7 +60,6 @@ define i32 @remove_dead_blocks_remaining_uses(i32 %a) { ; CHECK-LABEL: @remove_dead_blocks_remaining_uses( ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i32 1 -; CHECK-NEXT: } ; entry: ret i32 1 @@ -81,12 +77,11 @@ define i32 @remove_dead_blocks_remaining_uses2(i32 %a, i1 %cond) { ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i32 1 ; CHECK: bb.2: -; CHECK-NEXT: [[RES2:%.*]] = add i32 undef, 10 -; CHECK-NEXT: [[RES3:%.*]] = mul i32 [[RES2]], undef +; CHECK-NEXT: [[RES2:%.*]] = add i32 poison, 10 +; CHECK-NEXT: [[RES3:%.*]] = mul i32 [[RES2]], poison ; CHECK-NEXT: ret i32 [[RES3]] ; CHECK: bb.3: -; CHECK-NEXT: ret i32 undef -; CHECK-NEXT: } +; CHECK-NEXT: ret i32 poison ; entry: ret i32 1