diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-26 02:18:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-26 02:18:20 +0000 |
commit | 18f02318a65e176cb165ccff97478a7967aeef86 (patch) | |
tree | 0b13bcb3d3bdd3c45db20e742ae650313c647d15 /lib/Transforms | |
parent | 3796a262c50e0b04c1a5a9571f12bb9bc4936c25 (diff) |
Handle single-entry phi nodes gracefully in condprop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/CondPropagate.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp index 2e89943290..f68fb292e4 100644 --- a/lib/Transforms/Scalar/CondPropagate.cpp +++ b/lib/Transforms/Scalar/CondPropagate.cpp @@ -126,6 +126,14 @@ void CondProp::SimplifyPredecessors(BranchInst *BI) { // one use (the branch), and is the only instruction besides the branch in the // block. PHINode *PN = cast<PHINode>(BI->getCondition()); + + if (PN->getNumIncomingValues() == 1) { + // Eliminate single-entry PHI nodes. + FoldSingleEntryPHINodes(PN->getParent()); + return; + } + + if (!PN->hasOneUse()) return; BasicBlock *BB = BI->getParent(); |