Skip to content

Commit 2bcc4e5

Browse files
committed
Switch Neon, SVE, SME, and RVV builtins to use a prefix
This avoids repeating this part of the name in every string, shrinking the string tables. For SVE in particular, which is by-far the largest builtin string table, this gets us well under 200KiB. Others shrink by 30% - 50% depending on how long the rest of the strings end up. Overall, this completes restructuring the builtin string tables to try and minimize their size and hopefully avoid both toolchain bugs and compile-time memory overheads of the full sized string tables.
1 parent 24510f5 commit 2bcc4e5

File tree

15 files changed

+94
-79
lines changed

15 files changed

+94
-79
lines changed

clang/include/clang/Basic/Builtins.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ enum ID {
7070
FirstTSBuiltin
7171
};
7272

73+
struct InfosShard;
74+
7375
/// The info used to represent each builtin.
7476
struct Info {
7577
// Rather than store pointers to the string literals describing these four
@@ -83,6 +85,11 @@ struct Info {
8385

8486
HeaderDesc Header;
8587
LanguageID Langs;
88+
89+
/// Get the name for the builtin represented by this `Info` object.
90+
///
91+
/// Must be provided the `Shard` for this `Info` object.
92+
std::string getName(const InfosShard &Shard) const;
8693
};
8794

8895
/// A constexpr function to construct an infos array from X-macros.
@@ -120,6 +127,8 @@ static constexpr std::array<Info, N> MakeInfos(std::array<Info, N> Infos) {
120127
struct InfosShard {
121128
const llvm::StringTable *Strings;
122129
llvm::ArrayRef<Info> Infos;
130+
131+
llvm::StringLiteral NamePrefix = "";
123132
};
124133

125134
// A detail macro used below to emit a string literal that, after string literal
@@ -235,7 +244,11 @@ class Context {
235244

236245
/// Return the identifier name for the specified builtin,
237246
/// e.g. "__builtin_abs".
238-
llvm::StringRef getName(unsigned ID) const;
247+
std::string getName(unsigned ID) const;
248+
249+
/// Return the identifier name for the specified builtin inside single quotes
250+
/// for a diagnostic, e.g. "'__builtin_abs'".
251+
std::string getQuotedName(unsigned ID) const;
239252

240253
/// Get the type descriptor string for the specified builtin.
241254
const char *getTypeString(unsigned ID) const;

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static void diagnoseNonConstexprBuiltin(InterpState &S, CodePtr OpPC,
154154
if (S.getLangOpts().CPlusPlus11)
155155
S.CCEDiag(Loc, diag::note_constexpr_invalid_function)
156156
<< /*isConstexpr=*/0 << /*isConstructor=*/0
157-
<< ("'" + S.getASTContext().BuiltinInfo.getName(ID) + "'").str();
157+
<< S.getASTContext().BuiltinInfo.getQuotedName(ID);
158158
else
159159
S.CCEDiag(Loc, diag::note_invalid_subexpr_in_const_expr);
160160
}
@@ -1936,7 +1936,7 @@ static bool interp__builtin_memcmp(InterpState &S, CodePtr OpPC,
19361936
!isOneByteCharacterType(PtrB.getType()))) {
19371937
S.FFDiag(S.Current->getSource(OpPC),
19381938
diag::note_constexpr_memcmp_unsupported)
1939-
<< ("'" + ASTCtx.BuiltinInfo.getName(ID) + "'").str() << PtrA.getType()
1939+
<< ASTCtx.BuiltinInfo.getQuotedName(ID) << PtrA.getType()
19401940
<< PtrB.getType();
19411941
return false;
19421942
}

clang/lib/AST/ExprConstant.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9858,7 +9858,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
98589858
if (Info.getLangOpts().CPlusPlus11)
98599859
Info.CCEDiag(E, diag::note_constexpr_invalid_function)
98609860
<< /*isConstexpr*/ 0 << /*isConstructor*/ 0
9861-
<< ("'" + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'").str();
9861+
<< Info.Ctx.BuiltinInfo.getQuotedName(BuiltinOp);
98629862
else
98639863
Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
98649864
[[fallthrough]];
@@ -9903,8 +9903,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
99039903
// FIXME: We can compare the bytes in the correct order.
99049904
if (IsRawByte && !isOneByteCharacterType(CharTy)) {
99059905
Info.FFDiag(E, diag::note_constexpr_memchr_unsupported)
9906-
<< ("'" + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'").str()
9907-
<< CharTy;
9906+
<< Info.Ctx.BuiltinInfo.getQuotedName(BuiltinOp) << CharTy;
99089907
return false;
99099908
}
99109909
// Figure out what value we're actually looking for (after converting to
@@ -9966,7 +9965,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
99669965
if (Info.getLangOpts().CPlusPlus11)
99679966
Info.CCEDiag(E, diag::note_constexpr_invalid_function)
99689967
<< /*isConstexpr*/ 0 << /*isConstructor*/ 0
9969-
<< ("'" + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'").str();
9968+
<< Info.Ctx.BuiltinInfo.getQuotedName(BuiltinOp);
99709969
else
99719970
Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
99729971
[[fallthrough]];
@@ -13241,7 +13240,7 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1324113240
if (Info.getLangOpts().CPlusPlus11)
1324213241
Info.CCEDiag(E, diag::note_constexpr_invalid_function)
1324313242
<< /*isConstexpr*/ 0 << /*isConstructor*/ 0
13244-
<< ("'" + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'").str();
13243+
<< Info.Ctx.BuiltinInfo.getQuotedName(BuiltinOp);
1324513244
else
1324613245
Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
1324713246
[[fallthrough]];
@@ -13266,7 +13265,7 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1326613265
if (Info.getLangOpts().CPlusPlus11)
1326713266
Info.CCEDiag(E, diag::note_constexpr_invalid_function)
1326813267
<< /*isConstexpr*/ 0 << /*isConstructor*/ 0
13269-
<< ("'" + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'").str();
13268+
<< Info.Ctx.BuiltinInfo.getQuotedName(BuiltinOp);
1327013269
else
1327113270
Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr);
1327213271
[[fallthrough]];
@@ -13321,8 +13320,8 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1332113320
!(isOneByteCharacterType(CharTy1) && isOneByteCharacterType(CharTy2))) {
1332213321
// FIXME: Consider using our bit_cast implementation to support this.
1332313322
Info.FFDiag(E, diag::note_constexpr_memcmp_unsupported)
13324-
<< ("'" + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'").str()
13325-
<< CharTy1 << CharTy2;
13323+
<< Info.Ctx.BuiltinInfo.getQuotedName(BuiltinOp) << CharTy1
13324+
<< CharTy2;
1332613325
return false;
1332713326
}
1332813327

clang/lib/Basic/Builtins.cpp

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,22 @@ Builtin::Context::getShardAndInfo(unsigned ID) const {
7575
llvm_unreachable("Invalid target builtin shard structure!");
7676
}
7777

78+
std::string Builtin::Info::getName(const Builtin::InfosShard &Shard) const {
79+
return (Twine(Shard.NamePrefix) + (*Shard.Strings)[Offsets.Name]).str();
80+
}
81+
7882
/// Return the identifier name for the specified builtin,
7983
/// e.g. "__builtin_abs".
80-
llvm::StringRef Builtin::Context::getName(unsigned ID) const {
84+
std::string Builtin::Context::getName(unsigned ID) const {
85+
const auto &[Shard, I] = getShardAndInfo(ID);
86+
return I.getName(Shard);
87+
}
88+
89+
std::string Builtin::Context::getQuotedName(unsigned ID) const {
8190
const auto &[Shard, I] = getShardAndInfo(ID);
82-
return (*Shard.Strings)[I.Offsets.Name];
91+
return (Twine("'") + Shard.NamePrefix + (*Shard.Strings)[I.Offsets.Name] +
92+
"'")
93+
.str();
8394
}
8495

8596
const char *Builtin::Context::getTypeString(unsigned ID) const {
@@ -116,12 +127,14 @@ void Builtin::Context::InitializeTarget(const TargetInfo &Target,
116127
bool Builtin::Context::isBuiltinFunc(llvm::StringRef FuncName) {
117128
bool InStdNamespace = FuncName.consume_front("std-");
118129
for (const auto &Shard : {InfosShard{&BuiltinStrings, BuiltinInfos}})
119-
for (const auto &I : Shard.Infos)
120-
if (FuncName == (*Shard.Strings)[I.Offsets.Name] &&
121-
(bool)strchr((*Shard.Strings)[I.Offsets.Attributes].data(), 'z') ==
122-
InStdNamespace)
123-
return strchr((*Shard.Strings)[I.Offsets.Attributes].data(), 'f') !=
124-
nullptr;
130+
if (llvm::StringRef FuncNameSuffix = FuncName;
131+
FuncNameSuffix.consume_front(Shard.NamePrefix))
132+
for (const auto &I : Shard.Infos)
133+
if (FuncNameSuffix == (*Shard.Strings)[I.Offsets.Name] &&
134+
(bool)strchr((*Shard.Strings)[I.Offsets.Attributes].data(), 'z') ==
135+
InStdNamespace)
136+
return strchr((*Shard.Strings)[I.Offsets.Attributes].data(), 'f') !=
137+
nullptr;
125138

126139
return false;
127140
}
@@ -197,7 +210,7 @@ void Builtin::Context::initializeBuiltins(IdentifierTable &Table,
197210
for (const auto &I : Shard.Infos) {
198211
// If this is a real builtin (ID != 0) and is supported, add it.
199212
if (ID != 0 && builtinIsSupported(*Shard.Strings, I, LangOpts))
200-
Table.get((*Shard.Strings)[I.Offsets.Name]).setBuiltinID(ID);
213+
Table.get(I.getName(Shard)).setBuiltinID(ID);
201214
++ID;
202215
}
203216
assert(ID == FirstTSBuiltin && "Should have added all non-target IDs!");
@@ -206,14 +219,14 @@ void Builtin::Context::initializeBuiltins(IdentifierTable &Table,
206219
for (const auto &Shard : TargetShards)
207220
for (const auto &I : Shard.Infos) {
208221
if (builtinIsSupported(*Shard.Strings, I, LangOpts))
209-
Table.get((*Shard.Strings)[I.Offsets.Name]).setBuiltinID(ID);
222+
Table.get(I.getName(Shard)).setBuiltinID(ID);
210223
++ID;
211224
}
212225

213226
// Step #3: Register target-specific builtins for AuxTarget.
214227
for (const auto &Shard : AuxTargetShards)
215228
for (const auto &I : Shard.Infos) {
216-
Table.get((*Shard.Strings)[I.Offsets.Name]).setBuiltinID(ID);
229+
Table.get(I.getName(Shard)).setBuiltinID(ID);
217230
++ID;
218231
}
219232
}

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,11 +770,12 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
770770
llvm::SmallVector<Builtin::InfosShard>
771771
AArch64TargetInfo::getTargetBuiltins() const {
772772
return {
773-
{&NEON::BuiltinStrings, NEON::BuiltinInfos},
774-
{&NEON::FP16::BuiltinStrings, NEON::FP16::BuiltinInfos},
775-
{&SVE::BuiltinStrings, SVE::BuiltinInfos},
773+
{&NEON::BuiltinStrings, NEON::BuiltinInfos, "__builtin_neon_"},
774+
{&NEON::FP16::BuiltinStrings, NEON::FP16::BuiltinInfos,
775+
"__builtin_neon_"},
776+
{&SVE::BuiltinStrings, SVE::BuiltinInfos, "__builtin_sve_"},
776777
{&BuiltinSVENeonBridgeStrings, BuiltinSVENeonBridgeInfos},
777-
{&SME::BuiltinStrings, SME::BuiltinInfos},
778+
{&SME::BuiltinStrings, SME::BuiltinInfos, "__builtin_sme_"},
778779
{&BuiltinAArch64Strings, BuiltinAArch64Infos},
779780
};
780781
}

clang/lib/Basic/Targets/ARM.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,9 @@ static constexpr auto BuiltinInfos = Builtin::MakeInfos<NumARMBuiltins>({
11261126
llvm::SmallVector<Builtin::InfosShard>
11271127
ARMTargetInfo::getTargetBuiltins() const {
11281128
return {
1129-
{&NEON::BuiltinStrings, NEON::BuiltinInfos},
1130-
{&NEON::FP16::BuiltinStrings, NEON::FP16::BuiltinInfos},
1129+
{&NEON::BuiltinStrings, NEON::BuiltinInfos, "__builtin_neon_"},
1130+
{&NEON::FP16::BuiltinStrings, NEON::FP16::BuiltinInfos,
1131+
"__builtin_neon_"},
11311132
{&BuiltinStrings, BuiltinInfos},
11321133
};
11331134
}

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ namespace RVV {
255255
#define GET_RISCVV_BUILTIN_STR_TABLE
256256
#include "clang/Basic/riscv_vector_builtins.inc"
257257
#undef GET_RISCVV_BUILTIN_STR_TABLE
258-
static_assert(BuiltinStrings.size() < 100'000);
259258

260259
static constexpr std::array<Builtin::Info, NumRVVBuiltins> BuiltinInfos = {
261260
#define GET_RISCVV_BUILTIN_INFOS
@@ -293,8 +292,8 @@ static constexpr auto BuiltinInfos = Builtin::MakeInfos<NumRISCVBuiltins>({
293292
llvm::SmallVector<Builtin::InfosShard>
294293
RISCVTargetInfo::getTargetBuiltins() const {
295294
return {
296-
{&RVV::BuiltinStrings, RVV::BuiltinInfos},
297-
{&RVVSiFive::BuiltinStrings, RVVSiFive::BuiltinInfos},
295+
{&RVV::BuiltinStrings, RVV::BuiltinInfos, "__builtin_rvv_"},
296+
{&RVVSiFive::BuiltinStrings, RVVSiFive::BuiltinInfos, "__builtin_rvv_"},
298297
{&BuiltinStrings, BuiltinInfos},
299298
};
300299
}

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,10 @@ llvm::Constant *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
263263
unsigned BuiltinID) {
264264
assert(Context.BuiltinInfo.isLibFunction(BuiltinID));
265265

266-
// Get the name, skip over the __builtin_ prefix (if necessary).
267-
StringRef Name;
266+
// Get the name, skip over the __builtin_ prefix (if necessary). We may have
267+
// to build this up so provide a small stack buffer to handle the vast
268+
// majority of names.
269+
llvm::SmallString<64> Name;
268270
GlobalDecl D(FD);
269271

270272
// TODO: This list should be expanded or refactored after all GCC-compatible
@@ -6566,7 +6568,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
65666568
LargestVectorWidth = std::max(LargestVectorWidth, VectorWidth);
65676569

65686570
// See if we have a target specific intrinsic.
6569-
StringRef Name = getContext().BuiltinInfo.getName(BuiltinID);
6571+
std::string Name = getContext().BuiltinInfo.getName(BuiltinID);
65706572
Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
65716573
StringRef Prefix =
65726574
llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
@@ -21213,7 +21215,7 @@ static Value *MakeHalfType(unsigned IntrinsicID, unsigned BuiltinID,
2121321215
auto &C = CGF.CGM.getContext();
2121421216
if (!(C.getLangOpts().NativeHalfType ||
2121521217
!C.getTargetInfo().useFP16ConversionIntrinsics())) {
21216-
CGF.CGM.Error(E->getExprLoc(), C.BuiltinInfo.getName(BuiltinID).str() +
21218+
CGF.CGM.Error(E->getExprLoc(), C.BuiltinInfo.getQuotedName(BuiltinID) +
2121721219
" requires native half type support.");
2121821220
return nullptr;
2121921221
}

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3983,7 +3983,8 @@ namespace {
39833983
unsigned BuiltinID = FD->getBuiltinID();
39843984
if (!BuiltinID || !BI.isLibFunction(BuiltinID))
39853985
return false;
3986-
StringRef BuiltinName = BI.getName(BuiltinID);
3986+
std::string BuiltinNameStr = BI.getName(BuiltinID);
3987+
StringRef BuiltinName = BuiltinNameStr;
39873988
if (BuiltinName.starts_with("__builtin_") &&
39883989
Name == BuiltinName.slice(strlen("__builtin_"), StringRef::npos)) {
39893990
return true;

clang/lib/Sema/SemaChecking.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,9 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
12351235
bool IsChkVariant = false;
12361236

12371237
auto GetFunctionName = [&]() {
1238-
StringRef FunctionName = getASTContext().BuiltinInfo.getName(BuiltinID);
1238+
std::string FunctionNameStr =
1239+
getASTContext().BuiltinInfo.getName(BuiltinID);
1240+
llvm::StringRef FunctionName = FunctionNameStr;
12391241
// Skim off the details of whichever builtin was called to produce a better
12401242
// diagnostic, as it's unlikely that the user wrote the __builtin
12411243
// explicitly.
@@ -1245,7 +1247,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
12451247
} else {
12461248
FunctionName.consume_front("__builtin_");
12471249
}
1248-
return FunctionName;
1250+
return FunctionName.str();
12491251
};
12501252

12511253
switch (BuiltinID) {
@@ -1289,7 +1291,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
12891291
unsigned SourceSize) {
12901292
DiagID = diag::warn_fortify_scanf_overflow;
12911293
unsigned Index = ArgIndex + DataIndex;
1292-
StringRef FunctionName = GetFunctionName();
1294+
std::string FunctionName = GetFunctionName();
12931295
DiagRuntimeBehavior(TheCall->getArg(Index)->getBeginLoc(), TheCall,
12941296
PDiag(DiagID) << FunctionName << (Index + 1)
12951297
<< DestSize << SourceSize);
@@ -1438,7 +1440,7 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
14381440
llvm::APSInt::compareValues(*SourceSize, *DestinationSize) <= 0)
14391441
return;
14401442

1441-
StringRef FunctionName = GetFunctionName();
1443+
std::string FunctionName = GetFunctionName();
14421444

14431445
SmallString<16> DestinationStr;
14441446
SmallString<16> SourceStr;
@@ -4546,7 +4548,7 @@ ExprResult Sema::BuiltinAtomicOverloaded(ExprResult TheCallResult) {
45464548
// Get the decl for the concrete builtin from this, we can tell what the
45474549
// concrete integer type we should convert to is.
45484550
unsigned NewBuiltinID = BuiltinIndices[BuiltinIndex][SizeIndex];
4549-
StringRef NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
4551+
std::string NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
45504552
FunctionDecl *NewBuiltinDecl;
45514553
if (NewBuiltinID == BuiltinID)
45524554
NewBuiltinDecl = FDecl;
@@ -8332,7 +8334,7 @@ static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range,
83328334
unsigned AbsKind, QualType ArgType) {
83338335
bool EmitHeaderHint = true;
83348336
const char *HeaderName = nullptr;
8335-
StringRef FunctionName;
8337+
std::string FunctionName;
83368338
if (S.getLangOpts().CPlusPlus && !ArgType->isAnyComplexType()) {
83378339
FunctionName = "std::abs";
83388340
if (ArgType->isIntegralOrEnumerationType()) {
@@ -8481,7 +8483,7 @@ void Sema::CheckAbsoluteValueFunction(const CallExpr *Call,
84818483
// Unsigned types cannot be negative. Suggest removing the absolute value
84828484
// function call.
84838485
if (ArgType->isUnsignedIntegerType()) {
8484-
StringRef FunctionName =
8486+
std::string FunctionName =
84858487
IsStdAbs ? "std::abs" : Context.BuiltinInfo.getName(AbsKind);
84868488
Diag(Call->getExprLoc(), diag::warn_unsigned_abs) << ArgType << ParamType;
84878489
Diag(Call->getExprLoc(), diag::note_remove_abs)

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6687,7 +6687,7 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
66876687

66886688
Expr *Sema::BuildBuiltinCallExpr(SourceLocation Loc, Builtin::ID Id,
66896689
MultiExprArg CallArgs) {
6690-
StringRef Name = Context.BuiltinInfo.getName(Id);
6690+
std::string Name = Context.BuiltinInfo.getName(Id);
66916691
LookupResult R(*this, &Context.Idents.get(Name), Loc,
66926692
Sema::LookupOrdinaryName);
66936693
LookupName(R, TUScope, /*AllowBuiltinCreation=*/true);

clang/lib/StaticAnalyzer/Core/CheckerContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD,
5555
if (BId != 0) {
5656
if (Name.empty())
5757
return true;
58-
StringRef BName = FD->getASTContext().BuiltinInfo.getName(BId);
58+
std::string BName = FD->getASTContext().BuiltinInfo.getName(BId);
5959
size_t start = BName.find(Name);
6060
if (start != StringRef::npos) {
6161
// Accept exact match.

clang/utils/TableGen/NeonEmitter.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,16 +2068,12 @@ void NeonEmitter::genBuiltinsDef(raw_ostream &OS,
20682068
Table.GetOrAddStringOffset("");
20692069
Table.GetOrAddStringOffset("n");
20702070

2071-
auto PrefixName = [](Intrinsic *Def) -> std::string {
2072-
return (llvm::Twine("__builtin_neon_") + Def->getMangledName()).str();
2073-
};
2074-
20752071
for (auto *Def : Defs) {
20762072
if (Def->hasBody())
20772073
continue;
20782074

20792075
if (Builtins.insert({Def->getMangledName(), Def}).second) {
2080-
Table.GetOrAddStringOffset(PrefixName(Def));
2076+
Table.GetOrAddStringOffset(Def->getMangledName());
20812077
Table.GetOrAddStringOffset(Def->getBuiltinTypeStr());
20822078
Table.GetOrAddStringOffset(Def->getTargetGuard());
20832079
}
@@ -2097,8 +2093,8 @@ void NeonEmitter::genBuiltinsDef(raw_ostream &OS,
20972093
OS << "#ifdef GET_NEON_BUILTIN_INFOS\n";
20982094
for (const auto &[Name, Def] : Builtins) {
20992095
OS << " Builtin::Info{Builtin::Info::StrOffsets{"
2100-
<< Table.GetStringOffset(PrefixName(Def)) << " /* " << PrefixName(Def)
2101-
<< " */, ";
2096+
<< Table.GetStringOffset(Def->getMangledName()) << " /* "
2097+
<< Def->getMangledName() << " */, ";
21022098
OS << Table.GetStringOffset(Def->getBuiltinTypeStr()) << " /* "
21032099
<< Def->getBuiltinTypeStr() << " */, ";
21042100
OS << Table.GetStringOffset("n") << " /* n */, ";

0 commit comments

Comments
 (0)