Skip to content

[DebugInfo][CodeGenPrepare] Debug value loss caused by deleting the and instruction #139219

Open
@Apochens

Description

@Apochens

CodeGenPrepare pass deletes the and instruction without salvaging the debug value: https://godbolt.org/z/3d5f7v3oG

AndI->eraseFromParent();

IR before CodeGenPrepare:

entry:
  %and = and i32 %a, 4, !dbg !13
    #dbg_value(i32 %and, !9, !DIExpression(), !13)
  br i1 %c, label %bb0, label %bb2, !dbg !14

IR after CodeGenPrepare:

  entry:
      #dbg_value(i32 poison, !9, !DIExpression(), !11)
    br i1 %c, label %bb0, label %bb2, !dbg !12

I'd like to give a PR to fix it.

cc @OCHyams, could you please give me an example of how regression tests check the debug info in CodeGen? (I'm not very familiar with CodeGen...)

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