[PATCH] D80064: [X86] Disable LVI load hardening pass at O0
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 16 09:29:38 PDT 2020
nikic created this revision.
nikic added reviewers: craig.topper, mattdr, sconstab.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
D75936 <https://reviews.llvm.org/D75936> caused a compile-time regression for O0 builds (1.5% for sqlite), because the LVI load hardening pass requires a number of additional analysis passes. While load hardening is only performed if a function attribute is specified, the analysis passes will always be executed.
As it doesn't seem to be possible to only run the analysis passes if necessary, this change disables the LVI load hardening pass entirely at O0, on the assumption that this pass is only relevant for production binaries anyway.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80064
Files:
lib/Target/X86/X86TargetMachine.cpp
test/CodeGen/X86/O0-pipeline.ll
Index: test/CodeGen/X86/O0-pipeline.ll
===================================================================
--- test/CodeGen/X86/O0-pipeline.ll
+++ test/CodeGen/X86/O0-pipeline.ll
@@ -55,10 +55,6 @@
; CHECK-NEXT: Fast Register Allocator
; CHECK-NEXT: Bundle Machine CFG Edges
; CHECK-NEXT: X86 FP Stackifier
-; CHECK-NEXT: MachineDominator Tree Construction
-; CHECK-NEXT: Machine Natural Loop Construction
-; CHECK-NEXT: Machine Dominance Frontier Construction
-; CHECK-NEXT: X86 Load Value Injection (LVI) Load Hardening
; CHECK-NEXT: Fixup Statepoint Caller Saved
; CHECK-NEXT: Lazy Machine Block Frequency Analysis
; CHECK-NEXT: Machine Optimization Remark Emitter
Index: lib/Target/X86/X86TargetMachine.cpp
===================================================================
--- lib/Target/X86/X86TargetMachine.cpp
+++ lib/Target/X86/X86TargetMachine.cpp
@@ -497,7 +497,11 @@
void X86PassConfig::addPostRegAlloc() {
addPass(createX86FloatingPointStackifierPass());
- addPass(createX86LoadValueInjectionLoadHardeningPass());
+
+ // LVI load hardening requires a number of analysis passes that we do not
+ // want to run at optnone.
+ if (getOptLevel() != CodeGenOpt::None)
+ addPass(createX86LoadValueInjectionLoadHardeningPass());
}
void X86PassConfig::addPreSched2() { addPass(createX86ExpandPseudoPass()); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80064.264444.patch
Type: text/x-patch
Size: 1397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200516/66255d43/attachment.bin>
More information about the llvm-commits
mailing list