[PATCH] D106699: [NewPM] Add CrossDSOCFI pass irrespective of LTO optimization level
Pirama Arumuga Nainar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 23 14:13:33 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc45e17f11f50: [NewPM] Add CrossDSOCFI pass irrespective of LTO optimization level (authored by pirama).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106699/new/
https://reviews.llvm.org/D106699
Files:
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Other/new-pm-O0-defaults.ll
llvm/test/Other/new-pm-lto-defaults.ll
Index: llvm/test/Other/new-pm-lto-defaults.ll
===================================================================
--- llvm/test/Other/new-pm-lto-defaults.ll
+++ llvm/test/Other/new-pm-lto-defaults.ll
@@ -26,6 +26,7 @@
; RUN: --check-prefix=CHECK-O3 --check-prefix=CHECK-EP-Peephole
; CHECK-O: Running pass: Annotation2Metadata
+; CHECK-O-NEXT: Running pass: CrossDSOCFIPass
; CHECK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
@@ -123,7 +124,6 @@
; CHECK-O23SZ-NEXT: Running pass: InstCombinePass on foo
; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass on foo
; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass on foo
-; CHECK-O23SZ-NEXT: Running pass: CrossDSOCFIPass
; CHECK-O23SZ-NEXT: Running pass: LowerTypeTestsPass
; CHECK-O-NEXT: Running pass: LowerTypeTestsPass
; CHECK-O23SZ-NEXT: Running pass: SimplifyCFGPass
Index: llvm/test/Other/new-pm-O0-defaults.ll
===================================================================
--- llvm/test/Other/new-pm-O0-defaults.ll
+++ llvm/test/Other/new-pm-O0-defaults.ll
@@ -53,6 +53,7 @@
; CHECK-THINLTO-NEXT: Running pass: EliminateAvailableExternallyPass
; CHECK-THINLTO-NEXT: Running pass: GlobalDCEPass
; CHECK-LTO: Running pass: Annotation2MetadataPass
+; CHECK-LTO-NEXT: Running pass: CrossDSOCFIPass on [module]
; CHECK-LTO-NEXT: Running pass: WholeProgramDevirtPass
; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
Index: llvm/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -1647,6 +1647,10 @@
// Convert @llvm.global.annotations to !annotation metadata.
MPM.addPass(Annotation2MetadataPass());
+ // Create a function that performs CFI checks for cross-DSO calls with targets
+ // in the current module.
+ MPM.addPass(CrossDSOCFIPass());
+
if (Level == OptimizationLevel::O0) {
// The WPD and LowerTypeTest passes need to run at -O0 to lower type
// metadata and intrinsics.
@@ -1865,10 +1869,6 @@
MainFPM.addPass(JumpThreadingPass(/*InsertFreezeWhenUnfoldingSelect*/ true));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(MainFPM)));
- // Create a function that performs CFI checks for cross-DSO calls with
- // targets in the current module.
- MPM.addPass(CrossDSOCFIPass());
-
// Lower type metadata and the type.test intrinsic. This pass supports
// clang's control flow integrity mechanisms (-fsanitize=cfi*) and needs
// to be run at link time if CFI is enabled. This pass does nothing if
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106699.361351.patch
Type: text/x-patch
Size: 2720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210723/f5315799/attachment.bin>
More information about the llvm-commits
mailing list