[PATCH] D27560: Always run GlobalDCE at O0

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 18:52:13 PST 2016

> On Dec 13, 2016, at 6:39 PM, Robinson, Paul via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>> -----Original Message-----
>> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf
>> Of Joerg Sonnenberger via llvm-commits
>> Sent: Tuesday, December 13, 2016 6:24 PM
>> To: llvm-commits at lists.llvm.org
>> Subject: Re: [PATCH] D27560: Always run GlobalDCE at O0
>> On Tue, Dec 13, 2016 at 05:55:55PM -0800, Mehdi Amini via llvm-commits
>> wrote:
>>> Also, if always_inline is “required” for correctness it should process
>> all the calligraph.
>> always_inline is required for correctness. One example is a wrapper
>> function around vfork or setjmp.
> Correctness of C/C++, or correctness of LLVM IR?  The difference is in
> whether Clang sets up the always-inliner to run at O0, versus whether
> opt (and LLVM's default pass pipeline) set it up to run at O0.
> Remember that Clang does not use LLVM's pipeline, it generates its own.

Clang is using the same infrastructure as opt to setup the pipeline (mostly): llvm/lib/Transforms/IPO/PassManagerBuilder.cpp 
Are you referring to the option passed to the PassManagerBuilder? Or to the fact that clang adds some other passes manually in some cases? (Sanitizers…).

Also the issue here is not wether `opt -O0` should run the always_inliner, but how to make `always_inliner` runs on the full calligraph. Global-DCE is just a trick that eliminate the part of the calligraph not processed by always_inliner right now.

Chandler suggested on IRC that I look instead on making the always_inliner a function pass (or a module pass) like in the new pass manager. I thought about it originally but didn’t go this route because I was looking for a quick fix. However if the  always_inliner is already a module pass in the new PM, it shouldn’t be too hard to get there.


More information about the llvm-commits mailing list