Enable EliminateAvailableExternally pass in the LTO pipeline.
authorTeresa Johnson <tejohnson@google.com>
Tue, 11 Aug 2015 16:26:41 +0000 (16:26 +0000)
committerTeresa Johnson <tejohnson@google.com>
Tue, 11 Aug 2015 16:26:41 +0000 (16:26 +0000)
Summary:
For LTO we need to enable this pass in the LTO pipeline,
as it is skipped during the "-flto -c" compile step (when PrepareForLTO is
set).

Reviewers: rnk

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11919

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/PassManagerBuilder.cpp

index a4a1852de305e36eba14d2dee1d80159e499677f..9f58b49288a74998e147bb49dbdd31a8f23e9324 100644 (file)
@@ -556,6 +556,9 @@ void PassManagerBuilder::addLateLTOOptimizationPasses(
   // Delete basic blocks, which optimization passes may have killed.
   PM.add(createCFGSimplificationPass());
 
+  // Drop bodies of available externally objects to improve GlobalDCE.
+  PM.add(createEliminateAvailableExternallyPass());
+
   // Now that we have optimized the program, discard unreachable functions.
   PM.add(createGlobalDCEPass());