Issue 91836
Summary [DebugInfo][LoopLoadElim] Missing debug location updates
Labels new issue
Assignees
Reporter Apochens
    Missing debug location updates for new instructions at LoopLoadElimination[-L447](https://github.com/llvm/llvm-project/blob/e62ce1f8842cca36eb14126d79dcca0a85bf6d36/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp#L447), [-L452](https://github.com/llvm/llvm-project/blob/e62ce1f8842cca36eb14126d79dcca0a85bf6d36/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp#L452), [-L466](https://github.com/llvm/llvm-project/blob/e62ce1f8842cca36eb14126d79dcca0a85bf6d36/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp#L466).

```cpp
-> Value *Initial =
        new LoadInst(Cand.Load->getType(), InitialPtr, "load_initial",
                     /* isVolatile */ false, Cand.Load->getAlign(),
 PH->getTerminator()->getIterator());

->  PHINode *PHI = PHINode::Create(Initial->getType(), 2, "store_forwarded");
 PHI->insertBefore(L->getHeader()->begin());
    PHI->addIncoming(Initial, PH);

    ...

    Value *StoreValue = Cand.Store->getValueOperand();
    if (LoadType != StoreType)
-> StoreValue = CastInst::CreateBitOrPointerCast(StoreValue, LoadType,
 "store_forward_cast",
 Cand.Store->getIterator());

    PHI->addIncoming(StoreValue, L->getLoopLatch());

 Cand.Load->replaceAllUsesWith(PHI);
```

I'll give a patch for this later.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to