[llvm-bugs] [Bug 31561] New: [ThinLTO] Assertion "Local has more than one summary" fails when two source files have the same name
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 6 06:37:37 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31561
Bug ID: 31561
Summary: [ThinLTO] Assertion "Local has more than one summary"
fails when two source files have the same name
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: russell_gallop at sn.scee.net
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
ThinLTO hits an assertion in some cases where two source files have the same
name. Seen at r290351. The same examples work with full LTO and without LTO.
To reproduce (test.cpp and testb.cpp both exhibit this issue):
$ cat test.cpp
struct S {
S();
};
template <class> struct A { static S GO; };
template <class C> S A<C>::GO;
void fn1() { A<int>::GO; }
$ cat testb.cpp
#include <iostream>
$ cat test.sh
#!/bin/bash -e
CFLAGS="-flto=thin"
# Create two files with the same base name
mkdir -p a
cp $1 a/test.cpp
mkdir -p b
cp $1 b/test.cpp
# Files don't need to be identical
echo "void bar() {}" >> b/test.cpp
cd a
clang++ $CFLAGS -c test.cpp -o test.o
cd ..
cd b
clang++ $CFLAGS -c test.cpp -o testh.o
cd ..
if ! llvm-lto -thinlto-action=run a/test.o b/testh.o 2>&1 > /dev/null | grep
"Local has more than one summary"; then
exit 0
fi
exit 1
$ ./test.sh test.cpp
test.cpp:6:14: warning: expression result unused [-Wunused-value]
void fn1() { A<int>::GO; }
^~~~~~~~~~
1 warning generated.
test.cpp:6:14: warning: expression result unused [-Wunused-value]
void fn1() { A<int>::GO; }
^~~~~~~~~~
1 warning generated.
llvm-lto: <snip>/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:77: bool
llvm::FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal(const
llvm::GlobalValue*): Assertion `Summaries->second.size() == 1 && "Local has
more than one summary"' failed.
llvm-lto: <snip>/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:77: bool
llvm::FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal(const
llvm::GlobalValue*): Assertion `Summaries->second.size() == 1 && "Local has
more than one summary"' failed.
$ ./test.sh testb.cpp
llvm-lto: <snip>/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:77: bool
llvm::FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal(const
llvm::GlobalValue*): Assertion `Summaries->second.size() == 1 && "Local has
more than one summary"' failed.
llvm-lto: <snip>/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp:77: bool
llvm::FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal(const
llvm::GlobalValue*): Assertion `Summaries->second.size() == 1 && "Local has
more than one summary"' failed.
Failure introduced by this commit, which introduced the assertion which is
firing here.
commit 6e15e36dae54361e9f21b7711ad9bca48923f64a
Author: Teresa Johnson <tejohnson at google.com>
Date: Thu Nov 3 01:07:16 2016 +0000
[ThinLTO] Handle distributed backend case when doing renaming
Summary:
The recent change I made to consult the summary when deciding whether to
rename (to handle inline asm) in r285513 broke the distributed build
case. In a distributed backend we will only have a portion of the
combined index, specifically for imported modules we only have the
summaries for any imported definitions. When renaming on import we were
asserting because no summary entry was found for a local reference being
linked in (def wasn't imported).
We only need to consult the summary for a renaming decision for the
exporting module. For imports, we would have prevented importing any
references to NoRename values already.
Reviewers: mehdi_amini
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D26250
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285871
--
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/20170106/609f46e1/attachment-0001.html>
More information about the llvm-bugs
mailing list