diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-07-05 20:14:54 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-07-05 20:14:54 +0000 |
commit | d968f6f42377f6917b454b6508385f2f179b1f0c (patch) | |
tree | 4e300133dc975f79aa0f3d29f84357192cc8f18e /llvm/utils/TableGen/X86RecognizableInstr.cpp | |
parent | 8c4baa00de58e1f399cda78c5be5bd1fbb36c2b3 (diff) | |
download | bcm5719-llvm-d968f6f42377f6917b454b6508385f2f179b1f0c.tar.gz bcm5719-llvm-d968f6f42377f6917b454b6508385f2f179b1f0c.zip |
[tablegen] Avoid creating temporary strings
If a method / function returns a StringRef but the
variable is of type const std::string& a temporary string is
created (StringRef has a cast operator to std::string),
which is a suboptimal behavior.
Differential revision: https://reviews.llvm.org/D34994
Test plan: make check-all
llvm-svn: 307195
Diffstat (limited to 'llvm/utils/TableGen/X86RecognizableInstr.cpp')
-rw-r--r-- | llvm/utils/TableGen/X86RecognizableInstr.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/X86RecognizableInstr.cpp b/llvm/utils/TableGen/X86RecognizableInstr.cpp index 570c677a391..202a71ae4dc 100644 --- a/llvm/utils/TableGen/X86RecognizableInstr.cpp +++ b/llvm/utils/TableGen/X86RecognizableInstr.cpp @@ -367,7 +367,7 @@ void RecognizableInstr::handleOperand(bool optional, unsigned &operandIndex, ++operandIndex; } - const std::string &typeName = (*Operands)[operandIndex].Rec->getName(); + StringRef typeName = (*Operands)[operandIndex].Rec->getName(); OperandEncoding encoding = encodingFromString(typeName, OpSize); // Adjust the encoding type for an operand based on the instruction. |