[llvm-bugs] [Bug 35288] New: Partial inliner doesn't set up correct debug info which causes LTO to fail

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 13 06:27:12 PST 2017


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

            Bug ID: 35288
           Summary: Partial inliner doesn't set up correct debug info
                    which causes LTO to fail
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: eastig at yandex.ru
                CC: llvm-bugs at lists.llvm.org

The partial inliner does not set up debug info for instructions it has inlined.
During LTO a decision is made to inline a function the partial inliner created.
LTO has Verifier enabled. Verifier finds the resulted code does not have
correct debug info. This cause LTO to fail.

Reproducer:

$ cat test.c
int a02(int);

int a01(int v) {
  v = v * 100;
  return a02(v);
}

int a02(int v) {
  if (v > 2000)
    v *= 10;
  v += 200;
  return v;
}

$ clang -c -O3 -mthumb --target=arm-arm-none-eabi -mcpu=cortex-m7 test.c -g  -S
-emit-llvm -mllvm -disable-llvm-optzns

$ opt  -S -o test.pi.ll  -partial-inliner test.ll
-skip-partial-inlining-cost-analysis=true

$ opt  -S -o test.i.ll -inline test.pi.ll
!dbg attachment points at wrong subprogram for function
!8 = distinct !DISubprogram(name: "a01", scope: !1, file: !1, line: 3, type:
!9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped,
isOptimized: true, unit: !0, variables: !12)
i32 (i32)* @a01
  %4 = load i32, i32* %v.addr.i, align 4, !dbg !32, !tbaa !19
!32 = !DILocation(line: 10, column: 7, scope: !29)
!29 = distinct !DILexicalBlock(scope: !15, file: !1, line: 9, column: 7)
!15 = distinct !DISubprogram(name: "a02", scope: !1, file: !1, line: 8, type:
!9, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped,
isOptimized: true, unit: !0, variables: !16)
LLVM ERROR: Broken module found, compilation aborted!

---------
'test.c', 'test.ll' and 'test.pi.ll' are attached.

-- 
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/20171113/69bfb076/attachment.html>


More information about the llvm-bugs mailing list