Add new EliminateAvailableExternally module pass, which is performed in
authorTeresa Johnson <tejohnson@google.com>
Wed, 10 Jun 2015 17:49:28 +0000 (17:49 +0000)
committerTeresa Johnson <tejohnson@google.com>
Wed, 10 Jun 2015 17:49:28 +0000 (17:49 +0000)
commitb78ea510c146984bcd48723cd34f369024b25009
tree22f95eaf8a315f23b82dbeddf062fefa04a7c3a4
parent881c8e0c9ac3eb8d9d20d34b2354ac413f8146b4
Add new EliminateAvailableExternally module pass, which is performed in
O2 compiles just before GlobalDCE, unless we are preparing for LTO.

This pass eliminates available externally globals (turning them into
declarations), regardless of whether they are dead/unreferenced, since
we are guaranteed to have a copy available elsewhere at link time.
This enables additional opportunities for GlobalDCE.

If we are preparing for LTO (e.g. a -flto -c compile), the pass is not
included as we want to preserve available externally functions for possible
link time inlining. The FE indicates whether we are doing an -flto compile
via the new PrepareForLTO flag on the PassManagerBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239480 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/InitializePasses.h
include/llvm/Transforms/IPO.h
include/llvm/Transforms/IPO/PassManagerBuilder.h
lib/Transforms/IPO/CMakeLists.txt
lib/Transforms/IPO/ElimAvailExtern.cpp [new file with mode: 0644]
lib/Transforms/IPO/PassManagerBuilder.cpp