[llvm-bugs] [Bug 40777] New: [DebugInfo] Undef DBG_VALUE is emitted for float parameter passed on the stack

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 19 08:53:12 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40777

            Bug ID: 40777
           Summary: [DebugInfo] Undef DBG_VALUE is emitted for float
                    parameter passed on the stack
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: david.stenberg at ericsson.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

On r353941, if you compile the following code with `--target=arm -O1 -g':

    float fn1(int p1, int p2, int p3, int p4, float p5) {
      return p5;
    }

no non-undef location is emitted for p5:

    fn1:
    .Lfunc_begin0:
            .file   1 "/path/to/repo" "float.c"
            .loc    1 1 0                   @ float.c:1:0
            .fnstart
            .cfi_sections .debug_frame
            .cfi_startproc
    @ %bb.0:                                @ %entry
            @DEBUG_VALUE: fn1:p1 <- $r0
            @DEBUG_VALUE: fn1:p2 <- $r1
            @DEBUG_VALUE: fn1:p3 <- $r2
            @DEBUG_VALUE: fn1:p4 <- $r3
            ldr     r0, [sp]
    .Ltmp0:
            @DEBUG_VALUE: fn1:p5 <- undef <------------------------

llvm-dwarfdump output: 

    0x00000071:     DW_TAG_formal_parameter
                      DW_AT_name    ("p5")
                      DW_AT_decl_file       ("/path/to/repo/float.c")
                      DW_AT_decl_line       (1)
                      DW_AT_type    (0x0000007d "float")

llc -debug output:

    *** IR Dump After Module Verifier ***
    ; Function Attrs: norecurse nounwind readnone
    define dso_local arm_aapcscc float @fn1(i32 %p1, i32 %p2, i32 %p3, i32 %p4,
float returned %p5) local_unnamed_addr #0 !dbg !8 {
    entry:
      call void @llvm.dbg.value(metadata i32 %p1, metadata !14, metadata
!DIExpression()), !dbg !19
      call void @llvm.dbg.value(metadata i32 %p2, metadata !15, metadata
!DIExpression()), !dbg !20
      call void @llvm.dbg.value(metadata i32 %p3, metadata !16, metadata
!DIExpression()), !dbg !21
      call void @llvm.dbg.value(metadata i32 %p4, metadata !17, metadata
!DIExpression()), !dbg !22
      call void @llvm.dbg.value(metadata float %p5, metadata !18, metadata
!DIExpression()), !dbg !23
      ret float %p5, !dbg !24
    }
    # *** IR Dump Before ARM Instruction Selection ***:
    # Machine code for function fn1: IsSSA, TracksLiveness

    # End machine code for function fn1.

    # *** IR Dump After ARM Instruction Selection ***:
    # Machine code for function fn1: IsSSA, TracksLiveness
    Frame Objects:
      fi#-1: size=4, align=8, fixed, at location [SP]

    bb.0.entry:
      DBG_VALUE $r0, $noreg, !"p1", !DIExpression(), debug-location !19;
float.c:1:15 line no:1
      DBG_VALUE $r1, $noreg, !"p2", !DIExpression(), debug-location !20;
float.c:1:23 line no:1
      DBG_VALUE $r2, $noreg, !"p3", !DIExpression(), debug-location !21;
float.c:1:31 line no:1
      DBG_VALUE $r3, $noreg, !"p4", !DIExpression(), debug-location !22;
float.c:1:39 line no:1
      %4:gpr = LDRi12 %fixed-stack.0, 0, 14, $noreg :: (load 4 from
%fixed-stack.0, align 8)
      DBG_VALUE $noreg, $noreg, !"p5", !DIExpression(), debug-location !23;
float.c:1:49 line no:1
      $r0 = COPY %4:gpr, debug-location !24; float.c:2:3
      BX_RET 14, $noreg, implicit $r0, debug-location !24; float.c:2:3

    # End machine code for function fn1.

If you instead change p5 to an int, a FI-referencing debug value is inserted
for the parameter at the start of the function. That DBG_VALUE is produced by
the following code in EmitFuncArgumentDbgValue():

      if (!Op && N.getNode())
        // Check if frame index is available.
        if (LoadSDNode *LNode = dyn_cast<LoadSDNode>(N.getNode()))
          if (FrameIndexSDNode *FINode =
              dyn_cast<FrameIndexSDNode>(LNode->getBasePtr().getNode()))
            Op = MachineOperand::CreateFI(FINode->getIndex());

However, in the case of the float parameter, the LoadSDNode is wrapped by a
bitcast, resulting in that code not triggering.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190219/67e3194b/attachment-0001.html>


More information about the llvm-bugs mailing list