diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-01-08 10:51:32 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-01-08 10:51:32 +0000 |
commit | 3cc48a062821557a2ccaa8df26dd3a98d64c44b9 (patch) | |
tree | ba33ead484fe6cf9bfae162d2b2b91f62342e0b0 /lib | |
parent | 0b740236b71f0f3811421885c04cc43130f88bef (diff) | |
download | external_llvm-3cc48a062821557a2ccaa8df26dd3a98d64c44b9.zip external_llvm-3cc48a062821557a2ccaa8df26dd3a98d64c44b9.tar.gz external_llvm-3cc48a062821557a2ccaa8df26dd3a98d64c44b9.tar.bz2 |
Make sure we don't emit instructions before a landingpad instruction.
PR14782
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171846 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Utils/DemoteRegToStack.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index ee59e94..d5c41f5 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/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. |