prevent eliminating dbg_val due to COPY.
Fixes this
https://bugs.llvm.org/show_bug.cgi?id=40709
Differential D73159
ARM64: Debug info for structure argument missing DW_AT_location kamleshbhalui on Jan 21 2020, 8:21 PM. Authored by
Details
Diff Detail Event Timeline
Comment Actions @vsk thanks for reviewing. below dump is taken, by debugging the clang with this test #include<stdio.h> typedef struct { double a,b,c,d,e; }mystruct; void foo(mystruct ms){ printf("%llu\n",(unsigned long long) &ms); } This is the dump before erasing the MI () bb.1.entry: liveins: $x0 %0:gpr64(p0) = COPY $x0 %4:gpr64(p0) = MOVaddr target-flags(aarch64-page) @.str, target-flags(aarch64-pageoff, aarch64-nc) @.str, debug-location !DILocation(line: 0, scope: !9); kk3.c:0 DBG_VALUE %0:gpr64(p0), $noreg, !"ms", !DIExpression(DW_OP_deref), debug-location !22; kk3.c:5:19 line no:5 %1:gpr64(s64) = COPY %0:gpr64(p0), debug-location !23; kk3.c:7:1 ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp, debug-location !24; kk3.c:6:5 $x0 = COPY %4:gpr64(p0), debug-location !24; kk3.c:6:5 $x1 = COPY %1:gpr64(s64), debug-location !24; kk3.c:6:5 BL @printf, <regmask $fp $lr $b8 $b9 $b10 $b11 $b12 $b13 $b14 $b15 $d8 $d9 $d10 $d11 $d12 $d13 $d14 $d15 $h8 $h9 $h10 $h11 $h12 $h13 $h14 $h15 $s8 $s9 $s10 $s11 $s12 $s13 $s14 and 51 more...>, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit-def $w0, debug-location !24; kk3.c:6:5 ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp, debug-location !24; kk3.c:6:5 RET_ReallyLR debug-location !25; kk3.c:8:1 Once MI ( %1:gpr64(s64) = COPY %0:gpr64(p0), debug-location !23; kk3.c:7:1) # *** IR Dump After InstructionSelect ***: # Machine code for function foo: IsSSA, TracksLiveness, Legalized, RegBankSelected, Selected Function Live Ins: $x0 bb.1.entry: liveins: $x0 %0:gpr64 = COPY $x0 %4:gpr64 = MOVaddr target-flags(aarch64-page) @.str, target-flags(aarch64-pageoff, aarch64-nc) @.str, debug-location !DILocation(line: 0, scope: !9); kk3.c:0 DBG_VALUE $noreg, $noreg, !"ms", !DIExpression(DW_OP_deref), debug-location !22; kk3.c:5:19 line no:5 ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp, debug-location !24; kk3.c:6:5 $x0 = COPY %4:gpr64, debug-location !24; kk3.c:6:5 $x1 = COPY %0:gpr64, debug-location !24; kk3.c:6:5 BL @printf, <regmask $fp $lr $b8 $b9 $b10 $b11 $b12 $b13 $b14 $b15 $d8 $d9 $d10 $d11 $d12 $d13 $d14 $d15 $h8 $h9 $h10 $h11 $h12 $h13 $h14 $h15 $s8 $s9 $s10 $s11 $s12 $s13 $s14 and 51 more...>, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit-def $w0, debug-location !24; kk3.c:6:5 ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp, debug-location !24; kk3.c:6:5 RET_ReallyLR debug-location !25; kk3.c:8:1 Which makes difficult to debug even unoptimized code.
Comment Actions Thanks Daniel. If it's safe not to mark dbg values for removal here, that seems like the best option. Comment Actions I don't have time for the build bots today, but I can commit it tomorrow morning (European time) unless someone else picks it up before. |
If MI is erased, why should its debug uses not be made undef? What really causes those debug uses to be updated correctly?