diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-07-29 18:18:46 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-07-29 18:18:46 +0000 |
commit | 79c6bee7a93b9f5ff9f6d5bf5aa82dea3acf0f6a (patch) | |
tree | c0a75c916b8ac9a8dea057457a8efb52d81891ea /lib/Transforms | |
parent | d513b4033ff59526696c4db412362977a5b4fb8c (diff) | |
download | external_llvm-79c6bee7a93b9f5ff9f6d5bf5aa82dea3acf0f6a.zip external_llvm-79c6bee7a93b9f5ff9f6d5bf5aa82dea3acf0f6a.tar.gz external_llvm-79c6bee7a93b9f5ff9f6d5bf5aa82dea3acf0f6a.tar.bz2 |
SLPVectorier: update the debug location for the new instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Vectorize/SLPVectorizer.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 8f23a97..60d294b 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -58,8 +58,13 @@ static const unsigned RecursionMaxDepth = 12; /// RAII pattern to save the insertion point of the IR builder. class BuilderLocGuard { public: - BuilderLocGuard(IRBuilder<> &B) : Builder(B), Loc(B.GetInsertPoint()) {} - ~BuilderLocGuard() { if (Loc) Builder.SetInsertPoint(Loc); } + BuilderLocGuard(IRBuilder<> &B) : Builder(B), Loc(B.GetInsertPoint()), + DbgLoc(B.getCurrentDebugLocation()) {} + ~BuilderLocGuard() { + Builder.SetCurrentDebugLocation(DbgLoc); + if (Loc) + Builder.SetInsertPoint(Loc); + } private: // Prevent copying. @@ -67,6 +72,7 @@ private: BuilderLocGuard &operator=(const BuilderLocGuard &); IRBuilder<> &Builder; AssertingVH<Instruction> Loc; + DebugLoc DbgLoc; }; /// A helper class for numbering instructions in multible blocks. @@ -1177,6 +1183,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { case Instruction::PHI: { PHINode *PH = dyn_cast<PHINode>(VL0); Builder.SetInsertPoint(PH->getParent()->getFirstInsertionPt()); + Builder.SetCurrentDebugLocation(PH->getDebugLoc()); PHINode *NewPhi = Builder.CreatePHI(VecTy, PH->getNumIncomingValues()); E->VectorizedValue = NewPhi; @@ -1190,6 +1197,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { getIncomingValueForBlock(IBB)); Builder.SetInsertPoint(IBB->getTerminator()); + Builder.SetCurrentDebugLocation(PH->getDebugLoc()); Value *Vec = vectorizeTree(Operands); NewPhi->addIncoming(Vec, IBB); } @@ -1224,6 +1232,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { INVL.push_back(cast<Instruction>(E->Scalars[i])->getOperand(0)); Builder.SetInsertPoint(getLastInstruction(E->Scalars)); + Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); + Value *InVec = vectorizeTree(INVL); if (Value *V = alreadyVectorized(E->Scalars)) @@ -1243,6 +1253,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { } Builder.SetInsertPoint(getLastInstruction(E->Scalars)); + Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); + Value *L = vectorizeTree(LHSV); Value *R = vectorizeTree(RHSV); @@ -1268,6 +1280,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { } Builder.SetInsertPoint(getLastInstruction(E->Scalars)); + Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); + Value *Cond = vectorizeTree(CondVec); Value *True = vectorizeTree(TrueVec); Value *False = vectorizeTree(FalseVec); @@ -1304,6 +1318,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { } Builder.SetInsertPoint(getLastInstruction(E->Scalars)); + Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); + Value *LHS = vectorizeTree(LHSVL); Value *RHS = vectorizeTree(RHSVL); @@ -1323,6 +1339,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { // Loads are inserted at the head of the tree because we don't want to // sink them all the way down past store instructions. Builder.SetInsertPoint(getLastInstruction(E->Scalars)); + Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); + LoadInst *LI = cast<LoadInst>(VL0); Value *VecPtr = Builder.CreateBitCast(LI->getPointerOperand(), VecTy->getPointerTo()); @@ -1341,6 +1359,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { ValueOp.push_back(cast<StoreInst>(E->Scalars[i])->getValueOperand()); Builder.SetInsertPoint(getLastInstruction(E->Scalars)); + Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); + Value *VecValue = vectorizeTree(ValueOp); Value *VecPtr = Builder.CreateBitCast(SI->getPointerOperand(), VecTy->getPointerTo()); |