summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-06-25 20:45:45 +0000
committerCraig Topper <craig.topper@intel.com>2018-06-25 20:45:45 +0000
commit27847868b7bb4a1fcd5bf9839515171c92148c68 (patch)
treeb4df9a6cd06fcc9bcc92cd2f73e39e6cfe7f4abd /llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
parent0b3ed5742a68210e8225349a8f85a534e8a06d95 (diff)
downloadbcm5719-llvm-27847868b7bb4a1fcd5bf9839515171c92148c68.tar.gz
bcm5719-llvm-27847868b7bb4a1fcd5bf9839515171c92148c68.zip
[LoopIdiomRecognize] Fix a couple places where it appears we were unintenionally making copies of DebugLoc.
llvm-svn: 335521
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 3756cd024c8..1b423d8e7d8 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -188,7 +188,7 @@ private:
PHINode *CntPhi, Value *Var);
bool recognizeAndInsertCTLZ();
void transformLoopToCountable(BasicBlock *PreCondBB, Instruction *CntInst,
- PHINode *CntPhi, Value *Var, const DebugLoc DL,
+ PHINode *CntPhi, Value *Var, const DebugLoc &DL,
bool ZeroCheck, bool IsCntPhiUsedOutsideLoop);
/// @}
@@ -1433,9 +1433,8 @@ bool LoopIdiomRecognize::recognizeAndInsertCTLZ() {
TargetTransformInfo::TCC_Basic)
return false;
- const DebugLoc DL = DefX->getDebugLoc();
- transformLoopToCountable(PH, CntInst, CntPhi, InitX, DL, ZeroCheck,
- IsCntPhiUsedOutsideLoop);
+ transformLoopToCountable(PH, CntInst, CntPhi, InitX, DefX->getDebugLoc(),
+ ZeroCheck, IsCntPhiUsedOutsideLoop);
return true;
}
@@ -1548,7 +1547,7 @@ static CallInst *createCTLZIntrinsic(IRBuilder<> &IRBuilder, Value *Val,
/// If CntInst and DefX are not used in LOOP_BODY they will be removed.
void LoopIdiomRecognize::transformLoopToCountable(
BasicBlock *Preheader, Instruction *CntInst, PHINode *CntPhi, Value *InitX,
- const DebugLoc DL, bool ZeroCheck, bool IsCntPhiUsedOutsideLoop) {
+ const DebugLoc &DL, bool ZeroCheck, bool IsCntPhiUsedOutsideLoop) {
BranchInst *PreheaderBr = cast<BranchInst>(Preheader->getTerminator());
// Step 1: Insert the CTLZ instruction at the end of the preheader block
@@ -1635,7 +1634,7 @@ void LoopIdiomRecognize::transformLoopToPopcount(BasicBlock *PreCondBB,
PHINode *CntPhi, Value *Var) {
BasicBlock *PreHead = CurLoop->getLoopPreheader();
auto *PreCondBr = cast<BranchInst>(PreCondBB->getTerminator());
- const DebugLoc DL = CntInst->getDebugLoc();
+ const DebugLoc &DL = CntInst->getDebugLoc();
// Assuming before transformation, the loop is following:
// if (x) // the precondition
OpenPOWER on IntegriCloud