Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo][LoopLoadElim] Missing debug location updates #91836

Closed
Apochens opened this issue May 11, 2024 · 1 comment · Fixed by #91839
Closed

[DebugInfo][LoopLoadElim] Missing debug location updates #91836

Apochens opened this issue May 11, 2024 · 1 comment · Fixed by #91839

Comments

@Apochens
Copy link
Contributor

Missing debug location updates for new instructions at LoopLoadElimination-L447, -L452, -L466.

->  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.

@llvmbot
Copy link
Collaborator

llvmbot commented May 11, 2024

@llvm/issue-subscribers-debuginfo

Author: Shan Huang (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).
->  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants