summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-08 10:51:32 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-08 10:51:32 +0000
commit76c6521ba17ed6134d91ca2728250b67b720650b (patch)
tree78ff0093492ae6ca9e6299759baa40ac6644c671 /llvm/lib
parenta269c29e7f7063ee78ff9e98f8607beff2189d5a (diff)
downloadbcm5719-llvm-76c6521ba17ed6134d91ca2728250b67b720650b.tar.gz
bcm5719-llvm-76c6521ba17ed6134d91ca2728250b67b720650b.zip
Make sure we don't emit instructions before a landingpad instruction.
PR14782 llvm-svn: 171846
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/DemoteRegToStack.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
index ee59e946551..d5c41f54594 100644
--- a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
+++ b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
@@ -124,7 +124,12 @@ AllocaInst *llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
}
// Insert a load in place of the PHI and replace all uses.
- Value *V = new LoadInst(Slot, P->getName()+".reload", P);
+ BasicBlock::iterator InsertPt = P;
+
+ for (; isa<PHINode>(InsertPt) || isa<LandingPadInst>(InsertPt); ++InsertPt)
+ /* empty */; // Don't insert before PHI nodes or landingpad instrs.
+
+ Value *V = new LoadInst(Slot, P->getName()+".reload", InsertPt);
P->replaceAllUsesWith(V);
// Delete PHI.
OpenPOWER on IntegriCloud