Skip to content

Commit 8750d54

Browse files
committed
[X86][AutoUpgrade] Simplify string management in UpgradeDataLayoutString a bit. NFCI
We don't need a std::string for a literal string, we can use a StringRef. The addition of StringRefs produces a Twine that we can just call str() without converting to a SmallString ourselves. Twine will do that internally.
1 parent 9c7b0c4 commit 8750d54

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,7 +4308,7 @@ MDNode *llvm::upgradeInstructionLoopAttachment(MDNode &N) {
43084308
}
43094309

43104310
std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
4311-
std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
4311+
StringRef AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
43124312

43134313
// If X86, and the datalayout matches the expected format, add pointer size
43144314
// address spaces to the datalayout.
@@ -4320,9 +4320,7 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
43204320
if (!R.match(DL, &Groups))
43214321
return std::string(DL);
43224322

4323-
SmallString<1024> Buf;
4324-
std::string Res = (Groups[1] + AddrSpaces + Groups[3]).toStringRef(Buf).str();
4325-
return Res;
4323+
return (Groups[1] + AddrSpaces + Groups[3]).str();
43264324
}
43274325

43284326
void llvm::UpgradeAttributes(AttrBuilder &B) {

0 commit comments

Comments
 (0)