[llvm-bugs] [Bug 38114] New: "DISubprogram attached to more than one function" with -argpromotion -instcombine after r336419

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 9 22:36:51 PDT 2018


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

            Bug ID: 38114
           Summary: "DISubprogram attached to more than one function" with
                    -argpromotion -instcombine after r336419
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20545
  --> https://bugs.llvm.org/attachment.cgi?id=20545&action=edit
reproducer

With

  opt -S -o - foo.ll -argpromotion -instcombine

I get

DISubprogram attached to more than one function
!1 = distinct !DISubprogram(name: "func_27", scope: !2, file: !2, line: 
251, type: !3, isLocal: true, isDefinition: true, scopeLine: 252, 
isOptimized: false, unit: !5)
i64 ()* @func_27
LLVM ERROR: Broken module found, compilation aborted!

If I add -print-before-all -print-after-all -print-module-scope I get 
this as the last printouts:

*** IR Dump Before Module Verifier *** (function: func_27)
; ModuleID = 'foo.ll'
source_filename = "foo.ll"

@g_280 = external global i32

define i32 @func_1() {
bb1:
   %l_55.115 = alloca i32*, align 8
   %_tmp555 = load i32*, i32** %l_55.115, align 8
   %0 = call i64 @func_27()
   ret i32 undef
}

define internal i64 @func_27() !dbg !1 {
   store i32* @g_280, i32** undef, align 8
   ret i64 undef
}

define i16 @func_28() {
   %_tmp5791 = call i32 @func_1()
   ret i16 undef
}

!llvm.dbg.cu = !{}
!llvm.module.flags = !{!0}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = distinct !DISubprogram(name: "func_27", scope: !2, file: !2, line: 
251, type: !3, isLocal: true, isDefinition: true, scopeLine: 252, 
isOptimized: false, unit: !5)
!2 = !DIFile(filename: "foo.c", directory: "/bar")
!3 = !DISubroutineType(types: !4)
!4 = !{}
!5 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: 
"My compiler", isOptimized: false, runtimeVersion: 0, emissionKind: 
LineTablesOnly)
DISubprogram attached to more than one function
!1 = distinct !DISubprogram(name: "func_27", scope: !2, file: !2, line: 
251, type: !3, isLocal: true, isDefinition: true, scopeLine: 252, 
isOptimized: false, unit: !5)
i64 ()* @func_27
*** IR Dump After Module Verifier *** (function: func_27)
; ModuleID = 'foo.ll'
source_filename = "foo.ll"

@g_280 = external global i32

define i32 @func_1() {
bb1:
   %l_55.115 = alloca i32*, align 8
   %_tmp555 = load i32*, i32** %l_55.115, align 8
   %0 = call i64 @func_27()
   ret i32 undef
}

define internal i64 @func_27() !dbg !1 {
   store i32* @g_280, i32** undef, align 8
   ret i64 undef
}

define i16 @func_28() {
   %_tmp5791 = call i32 @func_1()
   ret i16 undef
}

!llvm.dbg.cu = !{}
!llvm.module.flags = !{!0}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = distinct !DISubprogram(name: "func_27", scope: !2, file: !2, line: 
251, type: !3, isLocal: true, isDefinition: true, scopeLine: 252, 
isOptimized: false, unit: !5)
!2 = !DIFile(filename: "foo.c", directory: "/bar")
!3 = !DISubroutineType(types: !4)
!4 = !{}
!5 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: 
"My compiler", isOptimized: false, runtimeVersion: 0, emissionKind: 
LineTablesOnly)
LLVM ERROR: Broken module found, compilation aborted!

As far as I can see in the printouts !1 is only used on func_27 and 
still it complains.

func27 was changed during argpromotion:

ARG PROMOTION:  Promoting to:
declare !dbg !0 internal i64 @func_27(i32*)

From:
define internal i64 @func_27(i32* %p1, i32* %p2) {
   store i32* %p1, i32** undef
   store i32* @g_280, i32** undef
   ret i64 undef
}

so I'm not sure if the old func_27 is still hanging around in some way?

This started happening after r336419:

    CallGraphSCCPass: iterate over all functions.

    Previously we only iterated over functions reachable from the set of
    external functions in the module. But since some of the passes under
    this (notably the always-inliner and coroutine lowerer) are required for
    correctness, they need to run over everything.

    This just adds an extra layer of iteration over the CallGraph to keep
    track of which functions we've already visited and get the next batch of
    SCCs.

    Should fix PR38029.


I've no idea if r336419 is really to blame here though or if it's just exposing
an already existing problem.

-- 
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/20180710/545f9942/attachment-0001.html>


More information about the llvm-bugs mailing list