[PATCH] D43916: Named VReg support for MIR

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 15 16:42:34 PDT 2018


thegameg added inline comments.


================
Comment at: include/llvm/CodeGen/MachineRegisterInfo.h:430
+  StringRef getVRegName(unsigned Reg) const {
+    return VReg2Name.inBounds(Reg) ? VReg2Name[Reg].c_str() : "";
+  }
----------------
bogner wrote:
> Very minor, but calling c_str() here causes an extra call to strlen - better to construct the StringRef from the std::string directly.
I think what @bogner meant here is to make use of StringRef’s constructor that takes an std::string (and uses the .size() from that object) instead of the constructor taking a const char * (which has to call strlen to get the actual size).


Repository:
  rL LLVM

https://reviews.llvm.org/D43916





More information about the llvm-commits mailing list