I want to emit a ref parameter (ie i32*) as if it was i32 in debug info, however when I emit it with llvm.debug.declare referring to the parameter register it shows the actual pointer value of the debug register, instead of the value it refers to. This works fine if the llvm.debug.declare points to a local alloca, how can this be and how can I make it work so both show the integer value directly?
define void @test1(i32) #0 !dbg !5 {
BasicBlock0:
%1 = alloca i32
store i32 %0, i32* %1
call void @llvm.dbg.declare(metadata i32* %1, metadata !20, metadata !22), !dbg !23
// This one is fine
%2 = load i32, i32* %1, !dbg !24
%3 = add i32 %2, 1, !dbg !24
store i32 %3, i32* %1, !dbg !24
ret void, !dbg !25
}
define void @ms_t1a_issuedebugouttest.__Global4_MEH2n_o_i32(i32*) #0 !dbg !9 {
BasicBlock3:
call void @llvm.dbg.declare(metadata i32* %0, metadata !26, metadata !22), !dbg !28
%1 = load i32, i32* %0, !dbg !29
%2 = add i32 %1, 1, !dbg !29
store i32 %2, i32* %0, !dbg !29
ret void, !dbg !30
}
!22 = !DIExpression()
!20 = !DILocalVariable(name: "i", scope: !21, file: !6, line: 11, type: !13)
!26 = !DILocalVariable(name: "i", scope: !27, file: !6, line: 15, type: !13)
!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "Integer", scope: !2, file: !3, baseType: !14)
!14 = !DIBasicType(name: "Integer", size: 32, align: 32, encoding: DW_ATE_signed)