[LLVMbugs] [Bug 23874] New: Inliner sometimes produces invalid debug info

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 17 11:30:51 PDT 2015


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

            Bug ID: 23874
           Summary: Inliner sometimes produces invalid debug info
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: dschuff at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I have an IR file with an approximate structure as follows. It has an inner and
outer function with debug info and a middle function without debug info.
The inner is inlined into the middle, and then the middle is inlined into the
outer. After inlining when the module verifier visits the DISubprogram for the
middle function, it checks the first instruction in middle (which originally
came from inner), gets the inlinedAtScope, finds that it points to inner, and
fails verification.

; Function Attrs: nounwind uwtable
define void @inner() #0 {
entry:
  <some random instruction> !dbg !13
  ret void, !dbg !14
}

; Function Attrs: nounwind uwtable
define void @middle() #0 {
entry:
  call void @inner()
  ret void
}

; Function Attrs: nounwind uwtable
define void @outer() #0 {
entry:
  call void @middle(), !dbg !21
  ret void, !dbg !18
}

I'm trying to figure out what the cause is; I tried building a simple
reproducer from scratch similar to the above, but I can't reproduce it.
I have attached a reproducer which is reduced by bugpoint; bugpoint did a
pretty good job reducing the code but did nothing to the debug info, which is
still huge, so I'm looking for some suggestions for making that smaller. I
tried removing the !llvm.dbg.cu from the module; this had mostly the effect I
was looking for, in causing most of the metadata to go away, but it also caused
the problem to no longer reproduce.

Any suggestions?




notes on the reproducer:
In the attached file, inner is
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_,
middle is
_ZNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strERKNS_12basic_stringIcS2_S4_EE, 
and outer is
_ZN7testing7MessageC2Ev

To reproduce just run opt -inline bugpoint-reduced-simplified.bc
The actual error is
!dbg attachment points at wrong subprogram for function
!22062 = !DISubprogram(name: "str", linkageName:
"_ZNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strERKNS_12basic_stringIcS2_S4_EE",
scope:
!"_ZTSNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE", file:
!519, line: 453, type: !15385, isLocal: false, isDefinition: true, scopeLine:
454, flags: DIFlagPrototyped, isOptimized: true, function: void
(%"class.std::__1::basic_stringbuf.130.422.2573.3290.4485.5202.6875.8070.8787.10460.10699.10938.11416.12372.17258"*,
%"class.std::__1::basic_string.5.297.2448.3165.4360.5077.6750.7945.8662.10335.10574.10813.11291.12247.17254"*)*
@_ZNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strERKNS_12basic_stringIcS2_S4_EE,
declaration: !15384, variables: !22063)
void
(%"class.std::__1::basic_stringbuf.130.422.2573.3290.4485.5202.6875.8070.8787.10460.10699.10938.11416.12372.17258"*,
%"class.std::__1::basic_string.5.297.2448.3165.4360.5077.6750.7945.8662.10335.10574.10813.11291.12247.17254"*)*
@_ZNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strERKNS_12basic_stringIcS2_S4_EE
  %cmp.i = icmp eq
%"class.std::__1::basic_string.5.297.2448.3165.4360.5077.6750.7945.8662.10335.10574.10813.11291.12247.17254"*
%__str_, %__s, !dbg !91052
!91057 = !DILocation(line: 2411, column: 14, scope: !91058)
!91058 = distinct !DILexicalBlock(scope: !59819, file: !32233, line: 2411,
column: 9)
!59819 = !DISubprogram(name: "operator=", linkageName:
"_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_",
scope: !"_ZTSNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE",
file: !32233, line: 2409, type: !53554, isLocal: false, isDefinition: true,
scopeLine: 2410, flags: DIFlagPrototyped, isOptimized: true, function: void
(%"class.std::__1::basic_string.5.297.2448.3165.4360.5077.6750.7945.8662.10335.10574.10813.11291.12247.17254"*,
%"class.std::__1::basic_string.5.297.2448.3165.4360.5077.6750.7945.8662.10335.10574.10813.11291.12247.17254"*)*
@_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_,
declaration: !58684, variables: !59820)
LLVM ERROR: Broken module found, compilation aborted!

-- 
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/20150617/96883a35/attachment.html>


More information about the llvm-bugs mailing list