diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-02-27 21:59:36 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-02-27 21:59:36 +0000 |
| commit | 1ad80e25116e43dbc6ab69c864539fa9f43874b7 (patch) | |
| tree | d6ca6e1d4cc72ba08adebf46cb362b68fd02d62f /llvm/lib | |
| parent | cabe8c0dac0c587c320dabb390cf5474dfcf53e5 (diff) | |
| download | bcm5719-llvm-1ad80e25116e43dbc6ab69c864539fa9f43874b7.tar.gz bcm5719-llvm-1ad80e25116e43dbc6ab69c864539fa9f43874b7.zip | |
Fix bug: 2003-02-27-StoreSinkPHIs.ll
llvm-svn: 5658
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 0febce48230..534a073abe1 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -437,7 +437,10 @@ void LICM::PromoteValuesInLoop() { for (succ_iterator SI = succ_begin(*I), SE = succ_end(*I); SI != SE; ++SI) if (!CurLoop->contains(*SI)) { // Copy all of the allocas into their memory locations... - Instruction *InsertPos = (*SI)->begin(); + BasicBlock::iterator BI = (*SI)->begin(); + while (isa<PHINode>(*BI)) + ++BI; // Skip over all of the phi nodes in the block... + Instruction *InsertPos = BI; for (unsigned i = 0, e = PromotedValues.size(); i != e; ++i) { // Load from the alloca... LoadInst *LI = new LoadInst(PromotedValues[i].first, "", InsertPos); |

