Skip to content

Commit e6ea877

Browse files
committed
[NewPM][optnone] Mark various passes as required
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
1 parent 58f5966 commit e6ea877

18 files changed

+34
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test that no passes are skipped under -O0/NPM
2+
//
3+
// 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
4+
// 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
5+
// 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
6+
// 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
7+
// 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
8+
// 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
9+
// 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
10+
// 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
11+
12+
// CHECK-NOT: Skipping pass
13+
14+
int func(int a) { return a; }

llvm/include/llvm/IR/IRPrintingPasses.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class PrintModulePass : public PassInfoMixin<PrintModulePass> {
7676
bool ShouldPreserveUseListOrder = false);
7777

7878
PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
79+
static bool isRequired() { return true; }
7980
};
8081

8182
/// Pass for printing a Function as LLVM's text IR assembly.
@@ -91,6 +92,7 @@ class PrintFunctionPass : public PassInfoMixin<PrintFunctionPass> {
9192
PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
9293

9394
PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
95+
static bool isRequired() { return true; }
9496
};
9597

9698
} // End llvm namespace

llvm/include/llvm/IR/PassManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,7 @@ struct RequireAnalysisPass
13081308

13091309
return PreservedAnalyses::all();
13101310
}
1311+
static bool isRequired() { return true; }
13111312
};
13121313

13131314
/// A no-op pass template which simply forces a specific analysis result

llvm/include/llvm/IR/Verifier.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class VerifierAnalysis : public AnalysisInfoMixin<VerifierAnalysis> {
116116

117117
Result run(Module &M, ModuleAnalysisManager &);
118118
Result run(Function &F, FunctionAnalysisManager &);
119+
static bool isRequired() { return true; }
119120
};
120121

121122
/// Check a module for errors, but report debug info errors separately.
@@ -141,6 +142,7 @@ class VerifierPass : public PassInfoMixin<VerifierPass> {
141142

142143
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
143144
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
145+
static bool isRequired() { return true; }
144146
};
145147

146148
} // end namespace llvm

llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Function;
2222

2323
struct CoroCleanupPass : PassInfoMixin<CoroCleanupPass> {
2424
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
25+
static bool isRequired() { return true; }
2526
};
2627
} // end namespace llvm
2728

llvm/include/llvm/Transforms/Coroutines/CoroEarly.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Function;
2525

2626
struct CoroEarlyPass : PassInfoMixin<CoroEarlyPass> {
2727
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
28+
static bool isRequired() { return true; }
2829
};
2930
} // end namespace llvm
3031

llvm/include/llvm/Transforms/Coroutines/CoroElide.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Function;
2424

2525
struct CoroElidePass : PassInfoMixin<CoroElidePass> {
2626
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
27+
static bool isRequired() { return true; }
2728
};
2829
} // end namespace llvm
2930

llvm/include/llvm/Transforms/Coroutines/CoroSplit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace llvm {
2424
struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
2525
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
2626
LazyCallGraph &CG, CGSCCUpdateResult &UR);
27+
static bool isRequired() { return true; }
2728
};
2829
} // end namespace llvm
2930

llvm/include/llvm/Transforms/IPO/AlwaysInliner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class AlwaysInlinerPass : public PassInfoMixin<AlwaysInlinerPass> {
3434
: InsertLifetime(InsertLifetime) {}
3535

3636
PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
37+
static bool isRequired() { return true; }
3738
};
3839

3940
/// Create a legacy pass manager instance of a pass to inline and remove

llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class AddressSanitizerPass : public PassInfoMixin<AddressSanitizerPass> {
102102
bool Recover = false,
103103
bool UseAfterScope = false);
104104
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
105+
static bool isRequired() { return true; }
105106

106107
private:
107108
bool CompileKernel;
@@ -122,6 +123,7 @@ class ModuleAddressSanitizerPass
122123
bool UseGlobalGC = true,
123124
bool UseOdrIndicator = false);
124125
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
126+
static bool isRequired() { return true; }
125127

126128
private:
127129
bool CompileKernel;

llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace llvm {
1717
/// stores, and other memory intrinsics.
1818
struct BoundsCheckingPass : PassInfoMixin<BoundsCheckingPass> {
1919
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
20+
static bool isRequired() { return true; }
2021
};
2122

2223

llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class HWAddressSanitizerPass : public PassInfoMixin<HWAddressSanitizerPass> {
2727
explicit HWAddressSanitizerPass(bool CompileKernel = false,
2828
bool Recover = false);
2929
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
30+
static bool isRequired() { return true; }
3031

3132
private:
3233
bool CompileKernel;

llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
4141

4242
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
4343
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
44+
static bool isRequired() { return true; }
4445

4546
private:
4647
MemorySanitizerOptions Options;

llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class ModuleSanitizerCoveragePass
4646
*vfs::getRealFileSystem());
4747
}
4848
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
49+
static bool isRequired() { return true; }
4950

5051
private:
5152
SanitizerCoverageOptions Options;

llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ FunctionPass *createThreadSanitizerLegacyPassPass();
2828
struct ThreadSanitizerPass : public PassInfoMixin<ThreadSanitizerPass> {
2929
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
3030
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
31+
static bool isRequired() { return true; }
3132
};
3233

3334
} // namespace llvm

llvm/include/llvm/Transforms/Scalar/LowerAtomic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace llvm {
2222
class LowerAtomicPass : public PassInfoMixin<LowerAtomicPass> {
2323
public:
2424
PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
25+
static bool isRequired() { return true; }
2526
};
2627
}
2728

llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace llvm {
1919
struct LowerMatrixIntrinsicsPass : PassInfoMixin<LowerMatrixIntrinsicsPass> {
2020
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
21+
static bool isRequired() { return true; }
2122
};
2223
} // namespace llvm
2324

llvm/test/Feature/optnone-opt.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ attributes #0 = { optnone noinline }
6666
; Additional IR passes that opt doesn't turn on by default.
6767
; MORE-DAG: Skipping pass 'Dead Code Elimination'
6868
; MORE-DAG: Skipping pass 'Dead Instruction Elimination'
69+
; NPM-MORE-DAG: Skipping pass: DCEPass
6970
; NPM-MORE-DAG: Skipping pass: GVNHoistPass
70-
; NPM-MORE-DAG: Skipping pass: LowerAtomicPass
7171

7272
; Loop IR passes that opt doesn't turn on by default.
7373
; LOOP-DAG: Skipping pass 'Delete dead loops'

0 commit comments

Comments
 (0)