[PATCH] D14148: [GlobalOpt] Demote globals to locals more aggressively
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 08:59:53 PDT 2015
majnemer added inline comments.
================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:1747
@@ +1746,3 @@
+
+// main() is known not to be recursive and to only be called once.
+static bool isFunctionMain(const Function *F) {
----------------
This is not true if the program is not a C++ program. `main` can be recursively called in C. Also, the name `main` may be reused for a function other than the entry point if it is not a hosted program which would be important to LTO something like the Linux kernel.
At the very least, we should check the functions prototype.
================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:1786
@@ +1785,3 @@
+ // FIXME: Deal with constantexpr bitcasts?
+ Instruction *I = dyn_cast<Instruction>(U);
+ if (!I)
----------------
`auto *I`
================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:1803
@@ +1802,3 @@
+ for (auto *UU : I->users()) {
+ LoadInst *LI = dyn_cast<LoadInst>(UU);
+ if (!LI)
----------------
`auto *LI`
Repository:
rL LLVM
http://reviews.llvm.org/D14148
More information about the llvm-commits
mailing list