forked from OSchip/llvm-project
[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.
This commit is contained in:
parent
9c7b0c4aa5
commit
8750d54cea
|
@ -4308,7 +4308,7 @@ MDNode *llvm::upgradeInstructionLoopAttachment(MDNode &N) {
|
|||
}
|
||||
|
||||
std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
|
||||
std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
|
||||
StringRef AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
|
||||
|
||||
// If X86, and the datalayout matches the expected format, add pointer size
|
||||
// address spaces to the datalayout.
|
||||
|
@ -4320,9 +4320,7 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
|
|||
if (!R.match(DL, &Groups))
|
||||
return std::string(DL);
|
||||
|
||||
SmallString<1024> Buf;
|
||||
std::string Res = (Groups[1] + AddrSpaces + Groups[3]).toStringRef(Buf).str();
|
||||
return Res;
|
||||
return (Groups[1] + AddrSpaces + Groups[3]).str();
|
||||
}
|
||||
|
||||
void llvm::UpgradeAttributes(AttrBuilder &B) {
|
||||
|
|
Loading…
Reference in New Issue