[llvm] [LLVM][TableGen] Use StringRef for various members `CGIOperandList::OperandInfo` (PR #140625)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 15:54:36 PDT 2025


================
@@ -142,8 +142,8 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
   }
 
   std::pair<unsigned, unsigned> SO = CGI.Operands.getSubOperandNumber(OpIdx);
-  std::string &EncoderMethodName =
-      CGI.Operands[SO.first].EncoderMethodNames[SO.second];
+  const std::string EncoderMethodName =
----------------
jurahul wrote:

No, it does not change. This is just creating a string from the StringRef and storing it in the `EncoderMethodName` variable. Its used later on to construct additional strings, so doing this instead of creating a StringRef Var and then doing .str() all over the place where EncoderMethodName is used.

https://github.com/llvm/llvm-project/pull/140625


More information about the llvm-commits mailing list