[PATCH] D14148: [GlobalOpt] Demote globals to locals more aggressively
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 10:51:43 PDT 2015
> On 2015-Oct-28, at 08:59, David Majnemer <david.majnemer at gmail.com> wrote:
>
> 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.
Note that this "main" shortcut isn't new; that check has been around
for quite some time.
> ================
> 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