[PATCH] D83797: Remove thousands of std::string instances in a helper function that is frequently called.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 11:55:36 PDT 2020


fhahn accepted this revision.
fhahn added a reviewer: fpetrogalli.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM thanks. It might be good to adjust the commit message to be a bit more descriptive, e.g. something like `[InjectTLIMappings] Use StringRef instead of std::string for FN name.`



================
Comment at: llvm/lib/Transforms/Utils/InjectTLIMappings.cpp:80
 
-  const std::string ScalarName = std::string(CI.getCalledFunction()->getName());
+  auto ScalarName = CI.getCalledFunction()->getName();
+
----------------
It might be worth spelling out StringRef here, as the return type is not completely obvious.


================
Comment at: llvm/lib/Transforms/Utils/InjectTLIMappings.cpp:86
     return;
+
   SmallVector<std::string, 8> Mappings;
----------------
nit: unrelated whitespace change.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83797/new/

https://reviews.llvm.org/D83797





More information about the llvm-commits mailing list