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) -- Carlo Kok RemObjects Software
Could you provide the complete example (with all the necessary metadata to reproduce)? Possible LLVM has a special case for arguments, I'm not sure/don't recall off hand, but can poke around at it & see if there's a reasonable logic to it. On Tue, Dec 20, 2016 at 10:43 PM Carlo Kok via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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) > > -- > Carlo Kok > RemObjects Software > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161221/03154369/attachment-0001.html>
https://gist.github.com/carlokok/77010598f81e8167592e593ec6c715a1 If needed I can strip it down more tomorrow, but only elements entry point and the two meh methods are used. On December 21, 2016 8:27:12 PM GMT+01:00, David Blaikie <dblaikie at gmail.com> wrote:>Could you provide the complete example (with all the necessary metadata >to >reproduce)? > >Possible LLVM has a special case for arguments, I'm not sure/don't >recall >off hand, but can poke around at it & see if there's a reasonable logic >to >it. > >On Tue, Dec 20, 2016 at 10:43 PM Carlo Kok via llvm-dev < >llvm-dev at lists.llvm.org> wrote: > >> 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) >> >> -- >> Carlo Kok >> RemObjects Software >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>-- Sent from my Android device with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161221/6b37e55f/attachment.html>
Possibly Parallel Threads
- debug info "ref" parameter
- debug info "ref" parameter
- debug info "ref" parameter
- Windows "0xC00001A5: An invalid exception handler routine has been detected" with LLVM win32 (i386) SEH code
- Windows "0xC00001A5: An invalid exception handler routine has been detected" with LLVM win32 (i386) SEH code