summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-11-17 10:23:23 +0000
committerDuncan Sands <baldrick@free.fr>2010-11-17 10:23:23 +0000
commit23a19572b2839ee3a6a3520d60d62a465cec7d53 (patch)
treec2c21d4d19c1585eb138cca7ce5279c97b01a7ee /lib/VMCore
parentbaa45f7298c266f0f89b17e50e9d98709dde84d7 (diff)
downloadllvm-23a19572b2839ee3a6a3520d60d62a465cec7d53.tar.gz
llvm-23a19572b2839ee3a6a3520d60d62a465cec7d53.tar.bz2
llvm-23a19572b2839ee3a6a3520d60d62a465cec7d53.tar.xz
Now that hasConstantValue has been made simpler, it may return the
phi node itself if it occurs in an unreachable basic block. Protect against this. Hopefully this will fix some more buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/BasicBlock.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 8ad53736c9..955a0285b2 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -248,10 +248,11 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.
Value* PNV = 0;
- if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue())) {
- PN->replaceAllUsesWith(PNV);
- PN->eraseFromParent();
- }
+ if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue()))
+ if (PNV != PN) {
+ PN->replaceAllUsesWith(PNV);
+ PN->eraseFromParent();
+ }
}
}
}