[NewPM][optnone] Mark various passes as required
authorArthur Eubanks <aeubanks@google.com>
Thu, 6 Aug 2020 18:10:14 +0000 (11:10 -0700)
committerArthur Eubanks <aeubanks@google.com>
Fri, 14 Aug 2020 22:51:59 +0000 (15:51 -0700)
This was done by turning on -enable-npm-optnone and fixing failures.
That will be enabled in a follow-up change for ease of reverting.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D85457

18 files changed:
clang/test/CodeGen/O0-no-skipped-passes.c [new file with mode: 0644]
llvm/include/llvm/IR/IRPrintingPasses.h
llvm/include/llvm/IR/PassManager.h
llvm/include/llvm/IR/Verifier.h
llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
llvm/include/llvm/Transforms/Coroutines/CoroElide.h
llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
llvm/test/Feature/optnone-opt.ll

diff --git a/clang/test/CodeGen/O0-no-skipped-passes.c b/clang/test/CodeGen/O0-no-skipped-passes.c
new file mode 100644 (file)
index 0000000..01b579c
--- /dev/null
@@ -0,0 +1,14 @@
+// Test that no passes are skipped under -O0/NPM
+//
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fcoroutines-ts 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=address 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=hwaddress 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=memory 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=thread 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=local-bounds 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -enable-npm-optnone -O0 -fexperimental-new-pass-manager %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize-coverage-trace-pc-guard 2>&1 | FileCheck %s
+
+// CHECK-NOT: Skipping pass
+
+int func(int a) { return a; }
index ed7082a..1cfd27a 100644 (file)
@@ -76,6 +76,7 @@ public:
                   bool ShouldPreserveUseListOrder = false);
 
   PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
+  static bool isRequired() { return true; }
 };
 
 /// Pass for printing a Function as LLVM's text IR assembly.
@@ -91,6 +92,7 @@ public:
   PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
 
   PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
+  static bool isRequired() { return true; }
 };
 
 } // End llvm namespace
index b259266..ff6a47b 100644 (file)
@@ -1308,6 +1308,7 @@ struct RequireAnalysisPass
 
     return PreservedAnalyses::all();
   }
+  static bool isRequired() { return true; }
 };
 
 /// A no-op pass template which simply forces a specific analysis result
index 62c33c8..f4381d2 100644 (file)
@@ -116,6 +116,7 @@ public:
 
   Result run(Module &M, ModuleAnalysisManager &);
   Result run(Function &F, FunctionAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 
 /// Check a module for errors, but report debug info errors separately.
@@ -141,6 +142,7 @@ public:
 
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 } // end namespace llvm
index c3caa55..7ecdc05 100644 (file)
@@ -22,6 +22,7 @@ class Function;
 
 struct CoroCleanupPass : PassInfoMixin<CoroCleanupPass> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // end namespace llvm
 
index 0f5d1e4..3f5ec2a 100644 (file)
@@ -25,6 +25,7 @@ class Function;
 
 struct CoroEarlyPass : PassInfoMixin<CoroEarlyPass> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // end namespace llvm
 
index 348e8e3..ff73cf2 100644 (file)
@@ -24,6 +24,7 @@ class Function;
 
 struct CoroElidePass : PassInfoMixin<CoroElidePass> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // end namespace llvm
 
index 40424e5..e93ad65 100644 (file)
@@ -24,6 +24,7 @@ namespace llvm {
 struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
   PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
                         LazyCallGraph &CG, CGSCCUpdateResult &UR);
+  static bool isRequired() { return true; }
 };
 } // end namespace llvm
 
index 64e2523..6a208df 100644 (file)
@@ -34,6 +34,7 @@ public:
       : InsertLifetime(InsertLifetime) {}
 
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 
 /// Create a legacy pass manager instance of a pass to inline and remove
index fea6064..53ad0cb 100644 (file)
@@ -102,6 +102,7 @@ public:
                                 bool Recover = false,
                                 bool UseAfterScope = false);
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
@@ -122,6 +123,7 @@ public:
                                       bool UseGlobalGC = true,
                                       bool UseOdrIndicator = false);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
index 120c6a8..8d70f14 100644 (file)
@@ -17,6 +17,7 @@ namespace llvm {
 /// stores, and other memory intrinsics.
 struct BoundsCheckingPass : PassInfoMixin<BoundsCheckingPass> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 
index e3104ee..f0949cf 100644 (file)
@@ -27,6 +27,7 @@ public:
   explicit HWAddressSanitizerPass(bool CompileKernel = false,
                                   bool Recover = false);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
index 01a86ee..f5f9ec7 100644 (file)
@@ -41,6 +41,7 @@ struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   MemorySanitizerOptions Options;
index 999086a..e3d268c 100644 (file)
@@ -46,6 +46,7 @@ public:
                                                *vfs::getRealFileSystem());
   }
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   SanitizerCoverageOptions Options;
index ce0e467..f9c5076 100644 (file)
@@ -28,6 +28,7 @@ FunctionPass *createThreadSanitizerLegacyPassPass();
 struct ThreadSanitizerPass : public PassInfoMixin<ThreadSanitizerPass> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 } // namespace llvm
index 40f8ca5..1d55508 100644 (file)
@@ -22,6 +22,7 @@ namespace llvm {
 class LowerAtomicPass : public PassInfoMixin<LowerAtomicPass> {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 }
 
index 2f75cd5..4ac0fdc 100644 (file)
@@ -18,6 +18,7 @@
 namespace llvm {
 struct LowerMatrixIntrinsicsPass : PassInfoMixin<LowerMatrixIntrinsicsPass> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // namespace llvm
 
index 1c8790f..7025bfe 100644 (file)
@@ -66,8 +66,8 @@ attributes #0 = { optnone noinline }
 ; Additional IR passes that opt doesn't turn on by default.
 ; MORE-DAG: Skipping pass 'Dead Code Elimination'
 ; MORE-DAG: Skipping pass 'Dead Instruction Elimination'
+; NPM-MORE-DAG: Skipping pass: DCEPass
 ; NPM-MORE-DAG: Skipping pass: GVNHoistPass
-; NPM-MORE-DAG: Skipping pass: LowerAtomicPass
 
 ; Loop IR passes that opt doesn't turn on by default.
 ; LOOP-DAG: Skipping pass 'Delete dead loops'