Skip to content

[DebugInfo][LoopStrengthReduce] Missing debug location updates for new phi and binop instructions #97510

Closed
@Apochens

Description

@Apochens

LSR-L2406, L2410

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

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

    /* 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();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions