Open
Description
In NewGVN, NewGVN::eliminateInstructions
deletes instructions by first marking them for deletion. In the following code, the instruction is deleted after being marked without having its debug value salvaged.
Here is an example: https://godbolt.org/z/K4EanM9Ka. In this example, %add2
is deleted and its debug value becomes poison.
; Before NewGVN
define void @binop(i32 %x, i32 %y) !dbg !5 {
%add1 = add i32 %x, %y, !dbg !12
#dbg_value(i32 %add1, !9, !DIExpression(), !12)
%add2 = add i32 %y, %x, !dbg !13
#dbg_value(i32 %add2, !11, !DIExpression(), !13)
call void @use(i32 %add1, i32 %add2), !dbg !14
ret void, !dbg !15
}
; After NewGVN
define void @binop(i32 %x, i32 %y) !dbg !5 {
%add1 = add i32 %x, %y, !dbg !12
#dbg_value(i32 %add1, !9, !DIExpression(), !12)
#dbg_value(i32 poison, !11, !DIExpression(), !13)
call void @use(i32 %add1, i32 %add1), !dbg !14
ret void, !dbg !15
}