diff options
author | Justin Bogner <mail@justinbogner.com> | 2013-09-27 15:30:25 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2013-09-27 15:30:25 +0000 |
commit | d237e834a816399b7e1561dd4db2c501f5095712 (patch) | |
tree | 86e680b36d931456afaed39efe9c66fc1985ca14 /lib/Transforms | |
parent | 0548a5487ab8648c7c017f87c507ea1bc38bbb1f (diff) | |
download | external_llvm-d237e834a816399b7e1561dd4db2c501f5095712.zip external_llvm-d237e834a816399b7e1561dd4db2c501f5095712.tar.gz external_llvm-d237e834a816399b7e1561dd4db2c501f5095712.tar.bz2 |
Transforms: Use getFirstNonPHI to set the insertion point for PHIs
We were previously using getFirstInsertionPt to insert PHI
instructions when vectorizing, but getFirstInsertionPt also skips past
landingpads, causing this to generate invalid IR.
We can avoid this issue by using getFirstNonPHI instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Vectorize/SLPVectorizer.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index e3bae02..4833aec 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -1552,7 +1552,7 @@ InnerLoopVectorizer::createEmptyLoop(LoopVectorizationLegality *Legal) { // Use this IR builder to create the loop instructions (Phi, Br, Cmp) // inside the loop. - Builder.SetInsertPoint(VecBody->getFirstInsertionPt()); + Builder.SetInsertPoint(VecBody->getFirstNonPHI()); // Generate the induction variable. setDebugLocFromInst(Builder, getDebugLocFromInstOrOperands(OldInduction)); diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index acb1560..7649fff 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1201,7 +1201,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { switch (Opcode) { case Instruction::PHI: { PHINode *PH = dyn_cast<PHINode>(VL0); - Builder.SetInsertPoint(PH->getParent()->getFirstInsertionPt()); + Builder.SetInsertPoint(PH->getParent()->getFirstNonPHI()); Builder.SetCurrentDebugLocation(PH->getDebugLoc()); PHINode *NewPhi = Builder.CreatePHI(VecTy, PH->getNumIncomingValues()); E->VectorizedValue = NewPhi; |