Skip to content

[DebugInfo][LoopStrengthReduce] Delete the cmp instruction without salvaging its debug value #147238

@Apochens

Description

@Apochens

In LSRInstance::OptimizeMax(), the condition of the deleted select instruction is also deleted, but its debug value (which could be salvaged) is not salvaged.

Instruction *Cmp = cast<Instruction>(Sel->getOperand(0));
Cond->eraseFromParent();
Sel->eraseFromParent();
if (Cmp->use_empty())
Cmp->eraseFromParent();

Here is an example: https://godbolt.org/z/dsvP787zc

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