[PATCH] D133537: [pipelines] Require GlobalsAA after sanitizers
Vitaly Buka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 14 13:34:01 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
vitalybuka marked an inline comment as done.
Closed by commit rGc69b26911168: [pipelines] Require GlobalsAA after sanitizers (authored by vitalybuka).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133537/new/
https://reviews.llvm.org/D133537
Files:
clang/lib/CodeGen/BackendUtil.cpp
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -668,7 +668,7 @@
// the logic of the original code, but operates on "shadow" values. It
// can benefit from re-running some general purpose optimization
// passes.
- MPM.addPass(RecomputeGlobalsAAPass());
+ MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
FunctionPassManager FPM;
FPM.addPass(EarlyCSEPass(true /* Enable mem-ssa. */));
FPM.addPass(InstCombinePass());
@@ -723,10 +723,21 @@
MPM.addPass(DataFlowSanitizerPass(LangOpts.NoSanitizeFiles));
}
};
- if (ClSanitizeOnOptimizerEarlyEP)
- PB.registerOptimizerEarlyEPCallback(SanitizersCallback);
- else
+ if (ClSanitizeOnOptimizerEarlyEP) {
+ PB.registerOptimizerEarlyEPCallback(
+ [SanitizersCallback](ModulePassManager &MPM, OptimizationLevel Level) {
+ ModulePassManager NewMPM;
+ SanitizersCallback(NewMPM, Level);
+ if (!NewMPM.isEmpty()) {
+ // Sanitizers can abandon<GlobalsAA>.
+ NewMPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
+ MPM.addPass(std::move(NewMPM));
+ }
+ });
+ } else {
+ // LastEP does not need GlobalsAA.
PB.registerOptimizerLastEPCallback(SanitizersCallback);
+ }
}
void EmitAssemblyHelper::RunOptimizationPipeline(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133537.460200.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220914/5767c698/attachment-0001.bin>
More information about the cfe-commits
mailing list