[PATCH] D133537: [pipelines] RecomputeGlobalsAAPass after OptimizerEarlyEPCallbacks

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 14 13:13:41 PDT 2022


vitalybuka updated this revision to Diff 460197.
vitalybuka edited the summary of this revision.
vitalybuka added a comment.

remove typo


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
@@ -669,7 +669,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());
@@ -724,10 +724,21 @@
       MPM.addPass(DataFlowSanitizerPass(LangOpts.NoSanitizeFiles));
     }
   };
-  if (ClSanitizeOnOptimizerEarlyEP)
-    PB.registerOptimizerEarlyEPCallback(SanitizersCallback);
-  else
+  if (ClSanitizeOnOptimizerEarlyEP) {
+    PB.registerOptimizerEarlyEPCallback(
+        [&](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.460197.patch
Type: text/x-patch
Size: 1488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220914/441ec024/attachment.bin>


More information about the cfe-commits mailing list