diff options
author | Stephen Tozer <stephen.tozer@sony.com> | 2025-04-17 18:30:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 17:30:09 +0100 |
commit | 1f224d889dfa89a293e3efa5b04740f634454370 (patch) | |
tree | 0eb40aadd40216df056b822cfdd2239f4d2f2f08 /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | |
parent | 5fe91f1b5948591b75416ce529b3179234c8d93d (diff) | |
download | llvm-1f224d889dfa89a293e3efa5b04740f634454370.zip llvm-1f224d889dfa89a293e3efa5b04740f634454370.tar.gz llvm-1f224d889dfa89a293e3efa5b04740f634454370.tar.bz2 |
[DebugInfo][IndVarSimplify] Propagate source loc when simplifying rem (#135399)
When IndVarSimplify simplifies a rem of the induction variable to a cmp
and select, only the select currently receives the rem's source
location; this patch propagates it to the cmp as well.
Found using https://github.com/llvm/llvm-project/pull/107279.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index 5a76bec..03dbf95 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -350,6 +350,7 @@ void SimplifyIndvar::replaceRemWithNumeratorOrZero(BinaryOperator *Rem) { auto *T = Rem->getType(); auto *N = Rem->getOperand(0), *D = Rem->getOperand(1); ICmpInst *ICmp = new ICmpInst(Rem->getIterator(), ICmpInst::ICMP_EQ, N, D); + ICmp->setDebugLoc(Rem->getDebugLoc()); SelectInst *Sel = SelectInst::Create(ICmp, ConstantInt::get(T, 0), N, "iv.rem", Rem->getIterator()); Rem->replaceAllUsesWith(Sel); |