[PATCH] D18883: Add a pass to name anonymous/nameless function

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 03:15:59 PDT 2016


george.burgess.iv added a subscriber: george.burgess.iv.
george.burgess.iv added a comment.

Hi! Just a few comments in passing for you. :)


================
Comment at: lib/Transforms/Utils/NameAnonFunctions.cpp:31
@@ +30,3 @@
+      continue;
+    if (!F.hasName())
+      continue;
----------------
Nit: Can this just be folded into `if (F.isDeclaration() || F.hasLocalLinkage() || !F.hasName())`?

================
Comment at: lib/Transforms/Utils/NameAnonFunctions.cpp:41
@@ +40,3 @@
+      continue;
+    if (!GV.hasName())
+      continue;
----------------
And this

================
Comment at: lib/Transforms/Utils/NameAnonFunctions.cpp:59
@@ +58,3 @@
+  auto ModuleHash = moduleHash(M);
+  Twine Prefix = Twine("anon.") + ModuleHash + ".";
+  int count = 0;
----------------
ISTM this code is making many `Twine`s here, and the lifetimes of all but the top-level `Twine` will end when we're done constructing `Prefix`, which is bad. Am I missing something?


http://reviews.llvm.org/D18883





More information about the llvm-commits mailing list