llvm.org GIT mirror llvm / 34e726e
Add support for handling ifuncs to GlobalValue::getBaseObject Summary: All GlobalIndirectSymbol types (not just GlobalAlias) should return their base object. Without this patch LTO would warn "Unable to determine comdat of alias!" for an ifunc. Reviewers: pcc Subscribers: mehdi_amini, inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D33202 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303096 91177308-0d34-0410-b5e6-96231b3b80d8 Teresa Johnson 3 years ago
3 changed file(s) with 17 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
254254 const GlobalObject *GlobalValue::getBaseObject() const {
255255 if (auto *GO = dyn_cast(this))
256256 return GO;
257 if (auto *GA = dyn_castAlias>(this))
257 if (auto *GA = dyn_castIndirectSymbol>(this))
258258 return GA->getBaseObject();
259259 return nullptr;
260260 }
0 ; RUN: opt -module-summary -o %t.bc %s
1 ; RUN: llvm-lto2 run %t.bc -r %t.bc,foo,pl -o %t2
2 ; RUN: llvm-nm %t2.0 | FileCheck %s
3 ; CHECK: T foo
4 ; CHECK: t foo_ifunc
5
6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
8
9 @foo = ifunc i32 (i32), i64 ()* @foo_ifunc
10
11 define internal i64 @foo_ifunc() {
12 entry:
13 ret i64 0
14 }
1111 ; CHECK-NEXT: C g3
1212 ; CHECK-NOT: g4
1313 ; CHECK-NEXT: T global_asm_sym
14 ; CHECK-NEXT: D ifunc_f1
14 ; CHECK-NEXT: T ifunc_f1
1515 ; CHECK-NEXT: t local_asm_sym
1616 ; CHECK-NEXT: U undef_asm_sy
1717