mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 09:57:08 +08:00
[UniqueLinkageName] Use exsiting GlobalDecl object instead of reconstructing one.
C++ constructors/destructors need to go through a different constructor to construct a GlobalDecl object in order to retrieve their linkage type. This causes an assert failure in the default constructor of GlobalDecl. I'm chaning it to using the exsiting GlobalDecl object. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102356
This commit is contained in:
@@ -2174,7 +2174,8 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
|
||||
// functions with -funique-internal-linkage-names.
|
||||
if (TargetDecl && CodeGenOpts.UniqueInternalLinkageNames) {
|
||||
if (auto *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
|
||||
if (this->getFunctionLinkage(Fn) == llvm::GlobalValue::InternalLinkage)
|
||||
if (this->getFunctionLinkage(CalleeInfo.getCalleeDecl()) ==
|
||||
llvm::GlobalValue::InternalLinkage)
|
||||
FuncAttrs.addAttribute("sample-profile-suffix-elision-policy",
|
||||
"selected");
|
||||
}
|
||||
|
||||
@@ -42,12 +42,26 @@ int mver_call() {
|
||||
return mver();
|
||||
}
|
||||
|
||||
namespace {
|
||||
class A {
|
||||
public:
|
||||
A() {}
|
||||
~A() {}
|
||||
};
|
||||
}
|
||||
|
||||
void test() {
|
||||
A a;
|
||||
}
|
||||
|
||||
// PLAIN: @_ZL4glob = internal global
|
||||
// PLAIN: @_ZZ8retAnonMvE5fGlob = internal global
|
||||
// PLAIN: @_ZN12_GLOBAL__N_16anon_mE = internal global
|
||||
// PLAIN: define internal i32 @_ZL3foov()
|
||||
// PLAIN: define internal i32 @_ZN12_GLOBAL__N_14getMEv
|
||||
// PLAIN: define weak_odr i32 ()* @_ZL4mverv.resolver()
|
||||
// PLAIN: define internal void @_ZN12_GLOBAL__N_11AC1Ev
|
||||
// PLAIN: define internal void @_ZN12_GLOBAL__N_11AD1Ev
|
||||
// PLAIN: define internal i32 @_ZL4mverv()
|
||||
// PLAIN: define internal i32 @_ZL4mverv.sse4.2()
|
||||
// PLAIN-NOT: "sample-profile-suffix-elision-policy"
|
||||
@@ -57,6 +71,8 @@ int mver_call() {
|
||||
// UNIQUE: define internal i32 @_ZL3foov.[[MODHASH:__uniq.[0-9]+]]() #[[#ATTR:]] {
|
||||
// UNIQUE: define internal i32 @_ZN12_GLOBAL__N_14getMEv.[[MODHASH]]
|
||||
// UNIQUE: define weak_odr i32 ()* @_ZL4mverv.[[MODHASH]].resolver()
|
||||
// UNIQUE: define internal void @_ZN12_GLOBAL__N_11AC1Ev.__uniq.68358509610070717889884130747296293671
|
||||
// UNIQUE: define internal void @_ZN12_GLOBAL__N_11AD1Ev.__uniq.68358509610070717889884130747296293671
|
||||
// UNIQUE: define internal i32 @_ZL4mverv.[[MODHASH]]()
|
||||
// UNIQUE: define internal i32 @_ZL4mverv.[[MODHASH]].sse4.2
|
||||
// UNIQUE: attributes #[[#ATTR]] = { {{.*}}"sample-profile-suffix-elision-policy"{{.*}} }
|
||||
|
||||
Reference in New Issue
Block a user