[PATCH] D58042: [LiveDebugValues] Emit parameter's entry value

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 06:50:19 PDT 2019


dstenb added a comment.

I cherry-picked the patches on top of r359425, and tried out some examples. Doing that, I encountered a case where entry values are not inserted with this patch.

When compiling the following code:

  int global;
  int foo(int p, int q, int r) {
    global = p + 1;
    asm __volatile ("" : : : "edi", "esi", "edx");
    return 123;
  }

using the following clang invocation:

  clang -O1 -g -Xclang -femit-param-entry-values -mllvm -stop-after=livedebugvalues

gives the following MIR:

  body:             |
    bb.0.entry:
      liveins: $edi
  
      DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !18
      DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !18
      DBG_VALUE $esi, $noreg, !16, !DIExpression(), debug-location !19
      DBG_VALUE $edx, $noreg, !17, !DIExpression(), debug-location !20
      renamable $edi = nsw ADD32ri8 killed renamable $edi, 1, implicit-def dead $eflags, debug-location !21
      DBG_VALUE $edi, $noreg, !15, !DIExpression(DW_OP_entry_value, 1), debug-location !18
      MOV32mr $rip, 1, $noreg, @global, $noreg, killed renamable $edi, debug-location !22 :: (store 4 into @global, !tbaa !23)
      INLINEASM &"", 1, 12, implicit-def dead early-clobber $edi, 12, implicit-def dead early-clobber $esi, 12, implicit-def dead early-clobber $edx, 12, implicit-def dead early-clobber $df, 12, implicit-def dead early-clobber $fpsw, 12, implicit-def dead early-clobber $eflags, !28, debug-location !27
      $eax = MOV32ri 123, debug-location !29
      RETQ killed $eax, debug-location !29

As seen, there is an entry value location inserted for `p` after `$edi` is clobbered by the `ADD32ri8` for `p + q`, but there are no entry value locations inserted for `q` and `r` after the inline assembly that clobbers their respective register. Is this perhaps due to some known limitation, or should this be considered a bug? Or have I overlooked something when testing this?

If I comment out the line that assigns the value to `global`, then LiveDebugValues emits entry value locations after the inline assembly for all three parameters.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58042/new/

https://reviews.llvm.org/D58042





More information about the llvm-commits mailing list