aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-05-20 20:41:24 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-05-20 20:41:24 +0000
commit498f2fd11bae925e3097b705211621fb62933d93 (patch)
treef19aef398ee01f8619313ffa3de89b9aebf386ee /llvm/lib/Target/X86/X86TargetMachine.cpp
parent9e7e8839b2bb372fbe76703cc0702fa9a8404057 (diff)
downloadllvm-498f2fd11bae925e3097b705211621fb62933d93.zip
llvm-498f2fd11bae925e3097b705211621fb62933d93.tar.gz
llvm-498f2fd11bae925e3097b705211621fb62933d93.tar.bz2
Address post-review for r270246
This gets rid of some unnecessary SmallStrings in X86TargetMachine::getSubtargetImpl. No functionality change is intended. llvm-svn: 270270
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 31918d0..8dd4c66 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -182,12 +182,17 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
Attribute CPUAttr = F.getFnAttribute("target-cpu");
Attribute FSAttr = F.getFnAttribute("target-features");
- SmallString<32> CPU = !CPUAttr.hasAttribute(Attribute::None)
- ? CPUAttr.getValueAsString()
- : (StringRef)TargetCPU;
- SmallString<512> FS = !FSAttr.hasAttribute(Attribute::None)
- ? FSAttr.getValueAsString()
- : (StringRef)TargetFS;
+ StringRef CPU = !CPUAttr.hasAttribute(Attribute::None)
+ ? CPUAttr.getValueAsString()
+ : (StringRef)TargetCPU;
+ StringRef FS = !FSAttr.hasAttribute(Attribute::None)
+ ? FSAttr.getValueAsString()
+ : (StringRef)TargetFS;
+
+ SmallString<512> Key;
+ Key.reserve(CPU.size() + FS.size());
+ Key += CPU;
+ Key += FS;
// FIXME: This is related to the code below to reset the target options,
// we need to know whether or not the soft float flag is set on the
@@ -199,12 +204,9 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
// If the soft float attribute is set on the function turn on the soft float
// subtarget feature.
if (SoftFloat)
- FS += FS.empty() ? "+soft-float" : ",+soft-float";
+ Key += FS.empty() ? "+soft-float" : ",+soft-float";
- SmallString<544> Key;
- Key.reserve(CPU.size() + FS.size());
- Key += CPU;
- Key += FS;
+ FS = Key.substr(CPU.size());
auto &I = SubtargetMap[Key];
if (!I) {