[PATCH] D33535: [PM] Teach the PGO instrumentation pasess to run GlobalDCE before instrumenting code.
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 00:15:31 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303845: [PM] Teach the PGO instrumentation pasess to run GlobalDCE before (authored by chandlerc).
Changed prior to commit:
https://reviews.llvm.org/D33535?vs=100202&id=100211#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33535
Files:
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/test/Transforms/GlobalDCE/externally_available.ll
Index: llvm/trunk/test/Transforms/GlobalDCE/externally_available.ll
===================================================================
--- llvm/trunk/test/Transforms/GlobalDCE/externally_available.ll
+++ llvm/trunk/test/Transforms/GlobalDCE/externally_available.ll
@@ -1,12 +1,21 @@
; RUN: opt < %s -globaldce -S | FileCheck %s
+; test_global should not be emitted to the .s file.
+; CHECK-NOT: @test_global =
+ at test_global = available_externally global i32 4
+
+; test_global2 is a normal global using an available externally function.
+; CHECK: @test_global2 =
+ at test_global2 = global i32 ()* @test_function2
+
; test_function should not be emitted to the .s file.
-; CHECK-NOT: test_function
+; CHECK-NOT: define {{.*}} @test_function()
define available_externally i32 @test_function() {
ret i32 4
}
-; test_global should not be emitted to the .s file.
-; CHECK-NOT: test_global
- at test_global = available_externally global i32 4
-
+; test_function2 isn't actually dead even though it's available externally.
+; CHECK: define available_externally i32 @test_function2()
+define available_externally i32 @test_function2() {
+ ret i32 4
+}
Index: llvm/trunk/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp
+++ llvm/trunk/lib/Passes/PassBuilder.cpp
@@ -437,6 +437,11 @@
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPipeline)));
}
+ // Delete anything that is now dead to make sure that we don't instrument
+ // dead code. Instrumentation can end up keeping dead code around and
+ // dramatically increase code size.
+ MPM.addPass(GlobalDCEPass());
+
if (RunProfileGen) {
MPM.addPass(PGOInstrumentationGen());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33535.100211.patch
Type: text/x-patch
Size: 1752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/9a40f836/attachment.bin>
More information about the llvm-commits
mailing list