This is an archive of the discontinued LLVM Phabricator instance.

Always run GlobalDCE before the inliner
AbandonedPublic

Authored by eugenis on Jul 15 2015, 11:26 AM.

Details

Reviewers
dberlin
Summary

Inliner, as an SCC pass, does not run on functions that are not reachable from the callgraph entry node.
Because of this, it may fail to inline an alwaysinline function.

The change runs GlobalDCE before inlining to make sure that this does not happen.
See the testcase for a sample input triggering this issue (the interesting case here is -O1, reproducing with both opt -O1 and clang -O1).

Diff Detail

Event Timeline

eugenis updated this revision to Diff 29804.Jul 15 2015, 11:26 AM
eugenis retitled this revision from to Always run GlobalDCE before the inliner.
eugenis updated this object.
eugenis added a reviewer: dberlin.
eugenis set the repository for this revision to rL LLVM.
eugenis added a subscriber: llvm-commits.
bruno added a subscriber: bruno.Jul 15 2015, 11:51 AM

Hi Evgeniy,

Did you run the test-suite? What is the overall compile time impact of this patch?

Thanks,

eugenis updated this revision to Diff 29824.Jul 15 2015, 1:46 PM
eugenis removed rL LLVM as the repository for this revision.

One more test + -O0 support in opt.

I'll run the test-suite and be back with the results.

Also see this change, which helps Clang tests deal with the new behavior of -O0:
http://reviews.llvm.org/D11238

Why does it matter if we don't inline an always_inline function into dead code?

To answer your question (better late than never):
https://groups.google.com/forum/#!msg/llvm-dev/gd5iud_trcA/UJ0JONSFAQAJ
http://reviews.llvm.org/D12087

I'm going to abandon this change in favor of D12087

eugenis abandoned this revision.Aug 27 2015, 2:30 PM