-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
debuginfollvm:GVNGVN and NewGVN stages (Global value numbering)GVN and NewGVN stages (Global value numbering)
Description
NewGVN deletes trivially dead instructions without salvaging the corresponding debug values (markInstructionForDeletion(&I)).
llvm-project/llvm/lib/Transforms/Scalar/NewGVN.cpp
Lines 3044 to 3049 in 145b6cd
| if (isInstructionTriviallyDead(&I, TLI)) { | |
| InstrDFS[&I] = 0; | |
| LLVM_DEBUG(dbgs() << "Skipping trivially dead instruction " << I << "\n"); | |
| markInstructionForDeletion(&I); | |
| continue; | |
| } |
Here is an example: https://godbolt.org/z/G4PWEv6nr. In this example, the icmp instruction is deleted without its debug value being slavaged.
Before the deletion:
bb1:
%tmp = load i8, ptr null, align 1, !dbg !25
#dbg_value(i8 %tmp, !9, !DIExpression(), !25)
%tmp2 = icmp eq i8 %tmp, 8, !dbg !26
#dbg_value(i1 %tmp2, !11, !DIExpression(), !26)
br label %bb3, !dbg !27After the deletion:
bb1:
%tmp = load i8, ptr null, align 1, !dbg !25
#dbg_value(i8 %tmp, !9, !DIExpression(), !25)
#dbg_value(i1 poison, !11, !DIExpression(), !26)
br label %bb3, !dbg !27Metadata
Metadata
Assignees
Labels
debuginfollvm:GVNGVN and NewGVN stages (Global value numbering)GVN and NewGVN stages (Global value numbering)