diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-04-28 00:19:07 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-04-28 00:19:07 +0000 |
| commit | 8be72700b8584390848350986b0cbb608f9df0a8 (patch) | |
| tree | 7b887788b2a4a85d953cc1130ec26023ab48e1b8 /llvm/lib/Transforms/Utils | |
| parent | 7855a5cb70d42e48e691fbca273e8c3edbbda7f1 (diff) | |
| download | bcm5719-llvm-8be72700b8584390848350986b0cbb608f9df0a8.tar.gz bcm5719-llvm-8be72700b8584390848350986b0cbb608f9df0a8.zip | |
Fix PR2256, yet another miscompilation in simplifycfg of i
multiple return values.
Bill, please pull this into Tak.
llvm-svn: 50332
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 7f37b45f2d4..b584e13876e 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1365,10 +1365,11 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { // If the return instruction returns a value, and if the value was a // PHI node in "BB", propagate the right value into the return. - if (NewRet->getNumOperands() == 1) - if (PHINode *PN = dyn_cast<PHINode>(NewRet->getOperand(0))) + for (unsigned i = 0, e = NewRet->getNumOperands(); i != e; ++i) + if (PHINode *PN = dyn_cast<PHINode>(NewRet->getOperand(i))) if (PN->getParent() == BB) - NewRet->setOperand(0, PN->getIncomingValueForBlock(Pred)); + NewRet->setOperand(i, PN->getIncomingValueForBlock(Pred)); + // Update any PHI nodes in the returning block to realize that we no // longer branch to them. BB->removePredecessor(Pred); |

