[PATCH] D51749: [GlobalISel] Lower dbg.declare into indirect DBG_VALUE

Josh Stone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 7 11:39:36 PDT 2018


cuviper added a comment.

In https://reviews.llvm.org/D51749#1226417, @rnk wrote:

> I think this change could use a more direct test, consider starting with the IR generated for a C++ object, like:
>
>   struct NTCopy {
>     NTCopy();
>     NTCopy(const NTCopy &);
>     int x;
>   };
>   int foo(NTCopy o) {
>     return o.x;
>   }
>


Thanks for this simple example -- it does indeed produce a bad `DEBUG_VALUE` of `$x0` before, now fixed to an indirect `[$x0+0]`.  I'll add this as a test.



================
Comment at: test/CodeGen/AArch64/GlobalISel/debug-insts.ll:12
 entry:
   %in.addr = alloca i32, align 4
----------------
rnk wrote:
> This test is strange, it declares the variable twice, once in %in.addr (correct) and again in %in (incorrect).
> This test is strange, it declares the variable twice, once in %in.addr (correct) and again in %in (incorrect).

Yeah, I don't know why.  Clang only produces the `%in.addr` version for `void debug_declare(int in)`.  Then you don't get any DBG_VALUE output for this function, but I think that's probably OK, and `in.addr` has CHECK lines above.  I can remove the plain `%in` one.


================
Comment at: test/CodeGen/AArch64/GlobalISel/debug-insts.ll:20
 ; CHECK-LABEL: name: debug_declare_vla
-; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use $noreg, !14, !DIExpression(), debug-location !15
+; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), 0, !14, !DIExpression(), debug-location !15
 define void @debug_declare_vla(i32 %in) #0 !dbg !13 {
----------------
rnk wrote:
> This change makes sense, though. The VLA is at some stack pointer offset. I assume p0 is the SP reg.
> I assume p0 is the SP reg.

Yes, the lines up to %6 compute the VLA size, and then:

    $sp = COPY %6(p0)
    %7:_(p0) = COPY %6(p0)
    DBG_VALUE debug-use %7(p0), 0, !14, !DIExpression(), debug-location !15



Repository:
  rL LLVM

https://reviews.llvm.org/D51749





More information about the llvm-commits mailing list