diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-23 16:52:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-23 16:52:34 +0000 |
commit | 89d46b0f095cf7f536c6ad40b4541b73d259445f (patch) | |
tree | 35dfa9d77303cad98a44782f81c5ab54eb00552f /lib/VMCore/BasicBlock.cpp | |
parent | 37dc78d0d3bcbcef070d0f6c445fa249e95bd89a (diff) | |
download | external_llvm-89d46b0f095cf7f536c6ad40b4541b73d259445f.zip external_llvm-89d46b0f095cf7f536c6ad40b4541b73d259445f.tar.gz external_llvm-89d46b0f095cf7f536c6ad40b4541b73d259445f.tar.bz2 |
Fix bug: test/Regression/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll
Which contains a description of why this is neccesary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 9a6301e..512ddb5 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -8,6 +8,7 @@ #include "llvm/iTerminators.h" #include "llvm/Type.h" #include "llvm/Support/CFG.h" +#include "llvm/Constant.h" #include "llvm/iPHINode.h" #include "llvm/CodeGen/MachineInstr.h" @@ -131,7 +132,9 @@ void BasicBlock::removePredecessor(BasicBlock *Pred) { // If the PHI _HAD_ two uses, replace PHI node with its now *single* value if (max_idx == 2) PN->replaceAllUsesWith(PN->getOperand(0)); - delete getInstList().remove(begin()); // Remove the PHI node + else // Otherwise there are no incoming values/edges, replace with dummy + PN->replaceAllUsesWith(Constant::getNullValue(PN->getType())); + delete getInstList().remove(begin()); // Remove the PHI node } } else { // Okay, now we know that we need to remove predecessor #pred_idx from all |