Skip to content

Commit 276b552

Browse files
committed
Set debug loc on the IRBuilder instead of instruction
1 parent 35fb19b commit 276b552

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,7 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
17641764
}
17651765

17661766
IRBuilder<> Builder(Preheader->getTerminator());
1767+
Builder.SetCurrentDebugLocation(CurLoop->getStartLoc());
17671768
SCEVExpander Expander(*SE, Preheader->getModule()->getDataLayout(),
17681769
"strlen_idiom");
17691770
Value *MaterialzedBase = Expander.expandCodeFor(
@@ -1778,9 +1779,6 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
17781779
}
17791780
assert(StrLenFunc && "Failed to emit strlen function.");
17801781

1781-
// Set debug location to the start of the loop.
1782-
cast<Instruction>(StrLenFunc)->setDebugLoc(CurLoop->getStartLoc());
1783-
17841782
const SCEV *StrlenEv = SE->getSCEV(StrLenFunc);
17851783
SmallVector<PHINode *, 4> Cleanup;
17861784
for (PHINode &PN : LoopExitBB->phis()) {

0 commit comments

Comments
 (0)