Open
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
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 !27
After 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 !27