@@ -1688,8 +1688,10 @@ static void AppendCPUSpecificCPUDispatchMangling(const CodeGenModule &CGM,
1688
1688
static void AppendTargetVersionMangling (const CodeGenModule &CGM,
1689
1689
const TargetVersionAttr *Attr,
1690
1690
raw_ostream &Out) {
1691
- if (Attr->isDefaultVersion ())
1691
+ if (Attr->isDefaultVersion ()) {
1692
+ Out << " .default" ;
1692
1693
return ;
1694
+ }
1693
1695
Out << " ._" ;
1694
1696
const TargetInfo &TI = CGM.getTarget ();
1695
1697
llvm::SmallVector<StringRef, 8 > Feats;
@@ -1752,8 +1754,10 @@ static void AppendTargetClonesMangling(const CodeGenModule &CGM,
1752
1754
const TargetInfo &TI = CGM.getTarget ();
1753
1755
if (TI.getTriple ().isAArch64 ()) {
1754
1756
StringRef FeatureStr = Attr->getFeatureStr (VersionIndex);
1755
- if (FeatureStr == " default" )
1757
+ if (FeatureStr == " default" ) {
1758
+ Out << " .default" ;
1756
1759
return ;
1760
+ }
1757
1761
Out << " ._" ;
1758
1762
SmallVector<StringRef, 8 > Features;
1759
1763
FeatureStr.split (Features, " +" );
@@ -3999,6 +4003,8 @@ void CodeGenModule::EmitMultiVersionFunctionDefinition(GlobalDecl GD,
3999
4003
EmitGlobalFunctionDefinition (GD.getWithMultiVersionIndex (I), nullptr );
4000
4004
// Ensure that the resolver function is also emitted.
4001
4005
GetOrCreateMultiVersionResolver (GD);
4006
+ } else if (FD->hasAttr <TargetVersionAttr>()) {
4007
+ GetOrCreateMultiVersionResolver (GD);
4002
4008
} else
4003
4009
EmitGlobalFunctionDefinition (GD, GV);
4004
4010
}
@@ -4180,14 +4186,7 @@ void CodeGenModule::emitMultiVersionFunctions() {
4180
4186
llvm::Constant *ResolverConstant = GetOrCreateMultiVersionResolver (GD);
4181
4187
if (auto *IFunc = dyn_cast<llvm::GlobalIFunc>(ResolverConstant)) {
4182
4188
ResolverConstant = IFunc->getResolver ();
4183
- // In Aarch64, default versions of multiversioned functions are mangled to
4184
- // their 'normal' assembly name. This deviates from other targets which
4185
- // append a '.default' string. As a result we need to continue appending
4186
- // .ifunc in Aarch64.
4187
- // FIXME: Should Aarch64 mangling for 'default' multiversion function and
4188
- // in turn ifunc function match that of other targets?
4189
- if (FD->isTargetClonesMultiVersion () &&
4190
- !getTarget ().getTriple ().isAArch64 ()) {
4189
+ if (FD->isTargetClonesMultiVersion ()) {
4191
4190
const CGFunctionInfo &FI = getTypes ().arrangeGlobalDeclaration (GD);
4192
4191
llvm::FunctionType *DeclTy = getTypes ().GetFunctionType (FI);
4193
4192
std::string MangledName = getMangledNameImpl (
@@ -4368,14 +4367,7 @@ llvm::Constant *CodeGenModule::GetOrCreateMultiVersionResolver(GlobalDecl GD) {
4368
4367
// a separate resolver).
4369
4368
std::string ResolverName = MangledName;
4370
4369
if (getTarget ().supportsIFunc ()) {
4371
- // In Aarch64, default versions of multiversioned functions are mangled to
4372
- // their 'normal' assembly name. This deviates from other targets which
4373
- // append a '.default' string. As a result we need to continue appending
4374
- // .ifunc in Aarch64.
4375
- // FIXME: Should Aarch64 mangling for 'default' multiversion function and
4376
- // in turn ifunc function match that of other targets?
4377
- if (!FD->isTargetClonesMultiVersion () ||
4378
- getTarget ().getTriple ().isAArch64 ())
4370
+ if (!FD->isTargetClonesMultiVersion ())
4379
4371
ResolverName += " .ifunc" ;
4380
4372
} else if (FD->isTargetMultiVersion ()) {
4381
4373
ResolverName += " .resolver" ;
0 commit comments