From 60a12907c309fa6e0ae465ffffef1ca3af8d7992 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 24 Mar 2008 20:16:14 +0000 Subject: Add incoming value from header only if phi node has any use inside the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48738 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopIndexSplit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/Transforms/Scalar/LoopIndexSplit.cpp') diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 3aedb93fd1..513cad8a56 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -1665,8 +1665,9 @@ void LoopIndexSplit::updatePHINodes(BasicBlock *ExitBB, BasicBlock *Latch, break; } - assert (NewV && "Unable to find new incoming value for exit block PHI"); - PN->addIncoming(NewV, Header); + // Add incoming value from header only if PN has any use inside the loop. + if (NewV) + PN->addIncoming(NewV, Header); } else if (Instruction *PHI = dyn_cast(V)) { // If this instruction is IVIncrement then IV is new incoming value -- cgit v1.2.3