From: Simon Pilgrim Date: Fri, 18 Dec 2020 16:00:27 +0000 (+0000) Subject: [X86] Avoid std::string creation in RecognizableInstr constructor. NFCI. X-Git-Tag: llvmorg-13-init~2957 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94da2cf650dd4397e8f84982c81e70f7a1825103;p=platform%2Fupstream%2Fllvm.git [X86] Avoid std::string creation in RecognizableInstr constructor. NFCI. The value names in byteFromRec calls are compile time constants - just create StringRef directly instead of via std::string. --- diff --git a/llvm/utils/TableGen/X86RecognizableInstr.cpp b/llvm/utils/TableGen/X86RecognizableInstr.cpp index 6a245b5..e4b7c05 100644 --- a/llvm/utils/TableGen/X86RecognizableInstr.cpp +++ b/llvm/utils/TableGen/X86RecognizableInstr.cpp @@ -54,7 +54,7 @@ static uint8_t byteFromBitsInit(BitsInit &init) { /// @param rec - The record from which to extract the value. /// @param name - The name of the field in the record. /// @return - The field, as translated by byteFromBitsInit(). -static uint8_t byteFromRec(const Record* rec, const std::string &name) { +static uint8_t byteFromRec(const Record* rec, StringRef name) { BitsInit* bits = rec->getValueAsBitsInit(name); return byteFromBitsInit(*bits); }