<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - "DISubprogram attached to more than one function" with -argpromotion -instcombine after r336419"
href="https://bugs.llvm.org/show_bug.cgi?id=38114">38114</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"DISubprogram attached to more than one function" with -argpromotion -instcombine after r336419
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mikael.holmen@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20545" name="attach_20545" title="reproducer">attachment 20545</a> <a href="attachment.cgi?id=20545&action=edit" title="reproducer">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>