Issue 97510
Summary [DebugInfo][LoopStrengthReduce] Missing debug location updates for new phi and binop instructions
Labels debuginfo, llvm:transforms
Assignees
Reporter Apochens
    [**LSR-L2406**](https://github.com/llvm/llvm-project/blob/3641efcf8cb256ddbd20f4add5ce55800cad5399/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp#L2406), [**L2410**](https://github.com/llvm/llvm-project/blob/3641efcf8cb256ddbd20f4add5ce55800cad5399/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp#L2410)

[L2406] The new phi instruction `NewPH` replacing the old phi instruction `PH` and cast instruction `ShadowUse` does not inherent any debug location.
[L2410] The new binop instruction `NewIncr` replacing the old binop instruction `Incr` does not inherent any debug location.

godbolt: https://godbolt.org/z/eGGd9Pxb5 (see `%IV.S.` and `%IV.S.next` in the optimized code)

```cpp
    /* Add new PHINode. */
->  PHINode *NewPH = PHINode::Create(DestTy, 2, "IV.S.", PH->getIterator());

 /* create new increment. '++d' in above example. */
    Constant *CFP = ConstantFP::get(DestTy, C->getZExtValue());
->  BinaryOperator *NewIncr = BinaryOperator::Create(
        Incr->getOpcode() == Instruction::Add ? Instruction::FAdd
                                              : Instruction::FSub,
        NewPH, CFP, "IV.S.next.", Incr->getIterator());

    NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry));
    NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch));

    /* Remove cast operation */
 ShadowUse->replaceAllUsesWith(NewPH);
 ShadowUse->eraseFromParent();
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to