[PATCH] D33202: [LTO] Use GlobalValue::getComdat which knows how to handle ifuncs
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 09:00:13 PDT 2017
tejohnson created this revision.
Herald added subscribers: inglorion, mehdi_amini.
The Value::getComdat interface (invoked by GlobalValue::getComdat) knows
how to handle ifuncs. Use this instead of getting the base object and
invoking getComdat on it. This was causing LTO to warn about
"Unable to determine comdat of alias!" for an ifunc.
https://reviews.llvm.org/D33202
Files:
lib/Object/IRSymtab.cpp
test/LTO/Resolution/X86/ifunc.ll
Index: test/LTO/Resolution/X86/ifunc.ll
===================================================================
--- /dev/null
+++ test/LTO/Resolution/X86/ifunc.ll
@@ -0,0 +1,15 @@
+; RUN: opt -module-summary -o %t.bc %s
+; RUN: llvm-lto2 run %t.bc -r %t.bc,foo,pl -o %t2
+; RUN: llvm-nm %t2.0 | FileCheck %s
+; CHECK: T foo
+; CHECK: t foo_ifunc
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at foo = ifunc i32 (i32), i64 ()* @foo_ifunc
+
+define internal i64 @foo_ifunc() {
+entry:
+ ret i64 0
+}
Index: lib/Object/IRSymtab.cpp
===================================================================
--- lib/Object/IRSymtab.cpp
+++ lib/Object/IRSymtab.cpp
@@ -188,11 +188,7 @@
Uncommon().CommonAlign = GV->getAlignment();
}
- const GlobalObject *Base = GV->getBaseObject();
- if (!Base)
- return make_error<StringError>("Unable to determine comdat of alias!",
- inconvertibleErrorCode());
- if (const Comdat *C = Base->getComdat()) {
+ if (const Comdat *C = GV->getComdat()) {
auto P = ComdatMap.insert(std::make_pair(C, Comdats.size()));
Sym.ComdatIndex = P.first->second;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33202.99013.patch
Type: text/x-patch
Size: 1193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170515/b55bc738/attachment.bin>
More information about the llvm-commits
mailing list