[llvm-branch-commits] [polly] r183380 - independent blocks: do not insert stores between phi nodes
Tobias Grosser
grosser at fim.uni-passau.de
Wed Jun 5 19:49:25 PDT 2013
Author: grosser
Date: Wed Jun 5 21:48:37 2013
New Revision: 183380
URL: http://llvm.org/viewvc/llvm-project?rev=183380&view=rev
Log:
independent blocks: do not insert stores between phi nodes
Merged from: https://llvm.org/svn/llvm-project/polly/trunk@182661
Modified:
polly/branches/release_33/lib/IndependentBlocks.cpp
Modified: polly/branches/release_33/lib/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_33/lib/IndependentBlocks.cpp?rev=183380&r1=183379&r2=183380&view=diff
==============================================================================
--- polly/branches/release_33/lib/IndependentBlocks.cpp (original)
+++ polly/branches/release_33/lib/IndependentBlocks.cpp Wed Jun 5 21:48:37 2013
@@ -394,9 +394,16 @@ bool IndependentBlocks::translateScalarT
AllocaInst *Slot = new AllocaInst(
Inst->getType(), 0, Inst->getName() + ".s2a", AllocaBlock->begin());
assert(!isa<InvokeInst>(Inst) && "Unexpect Invoke in Scop!");
- // Store right after Inst.
- BasicBlock::iterator StorePos = Inst;
- (void) new StoreInst(Inst, Slot, ++StorePos);
+
+ // Store right after Inst, and make sure the position is after all phi nodes.
+ BasicBlock::iterator StorePos;
+ if (isa<PHINode>(Inst)) {
+ StorePos = Inst->getParent()->getFirstNonPHI();
+ } else {
+ StorePos = Inst;
+ StorePos++;
+ }
+ (void) new StoreInst(Inst, Slot, StorePos);
if (!LoadOutside.empty()) {
LoadInst *ExitLoad = new LoadInst(Slot, Inst->getName() + ".loadoutside",
More information about the llvm-branch-commits
mailing list