llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[DebugInfo][SimplifyIndVar] Missing debug location updates for div/rem instructions

Open svs-quic opened this issue 2 years ago • 1 comments

There are three instances where the debug information has not been propagated to the new div/rem instructions:

bool SimplifyIndvar::eliminateSDiv(BinaryOperator *SDiv) {
auto *UDiv = BinaryOperator::Create(
        BinaryOperator::UDiv, SDiv->getOperand(0), SDiv->getOperand(1),
        SDiv->getName() + ".udiv", SDiv->getIterator());
UDiv->setIsExact(SDiv->isExact());
SDiv->replaceAllUsesWith(UDiv);
void SimplifyIndvar::replaceSRemWithURem(BinaryOperator *Rem) {
auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
                                      Rem->getName() + ".urem", Rem->getIterator());
Rem->replaceAllUsesWith(URem);
void SimplifyIndvar::replaceRemWithNumeratorOrZero(BinaryOperator *Rem) {
SelectInst *Sel =
      SelectInst::Create(ICmp, ConstantInt::get(T, 0), N, "iv.rem", Rem->getIterator());
Rem->replaceAllUsesWith(Sel);

svs-quic avatar Jul 01 '24 11:07 svs-quic

@llvm/issue-subscribers-debuginfo

Author: Sudharsan Veeravalli (svs-quic)

There are three instances where the debug information has not been propagated to the new div/rem instructions:
bool SimplifyIndvar::eliminateSDiv(BinaryOperator *SDiv) {
auto *UDiv = BinaryOperator::Create(
        BinaryOperator::UDiv, SDiv->getOperand(0), SDiv->getOperand(1),
        SDiv->getName() + ".udiv", SDiv->getIterator());
UDiv->setIsExact(SDiv->isExact());
SDiv->replaceAllUsesWith(UDiv);
void SimplifyIndvar::replaceSRemWithURem(BinaryOperator *Rem) {
auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
                                      Rem->getName() + ".urem", Rem->getIterator());
Rem->replaceAllUsesWith(URem);
void SimplifyIndvar::replaceRemWithNumeratorOrZero(BinaryOperator *Rem) {
SelectInst *Sel =
      SelectInst::Create(ICmp, ConstantInt::get(T, 0), N, "iv.rem", Rem->getIterator());
Rem->replaceAllUsesWith(Sel);

llvmbot avatar Jul 01 '24 14:07 llvmbot