diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/DivRemPairs.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/DivRemPairs.cpp b/llvm/lib/Transforms/Scalar/DivRemPairs.cpp index f7ada9f..d8aea1e 100644 --- a/llvm/lib/Transforms/Scalar/DivRemPairs.cpp +++ b/llvm/lib/Transforms/Scalar/DivRemPairs.cpp @@ -215,6 +215,7 @@ static bool optimizeDivRem(Function &F, const TargetTransformInfo &TTI, RemInst = RealRem; // And replace the original instruction with the new one. OrigRemInst->replaceAllUsesWith(RealRem); + RealRem->setDebugLoc(OrigRemInst->getDebugLoc()); OrigRemInst->eraseFromParent(); NumRecomposed++; // Note that we have left ((X / Y) * Y) around. @@ -366,7 +367,9 @@ static bool optimizeDivRem(Function &F, const TargetTransformInfo &TTI, if (!DivDominates) DivInst->moveBefore(RemInst); Mul->insertAfter(RemInst); + Mul->setDebugLoc(RemInst->getDebugLoc()); Sub->insertAfter(Mul); + Sub->setDebugLoc(RemInst->getDebugLoc()); // If DivInst has the exact flag, remove it. Otherwise this optimization // may replace a well-defined value 'X % Y' with poison. @@ -384,6 +387,7 @@ static bool optimizeDivRem(Function &F, const TargetTransformInfo &TTI, if (!isGuaranteedNotToBeUndef(X, nullptr, DivInst, &DT)) { auto *FrX = new FreezeInst(X, X->getName() + ".frozen", DivInst->getIterator()); + FrX->setDebugLoc(DivInst->getDebugLoc()); DivInst->setOperand(0, FrX); Sub->setOperand(0, FrX); } @@ -392,6 +396,7 @@ static bool optimizeDivRem(Function &F, const TargetTransformInfo &TTI, if (!isGuaranteedNotToBeUndef(Y, nullptr, DivInst, &DT)) { auto *FrY = new FreezeInst(Y, Y->getName() + ".frozen", DivInst->getIterator()); + FrY->setDebugLoc(DivInst->getDebugLoc()); DivInst->setOperand(1, FrY); Mul->setOperand(1, FrY); } |