diff --git a/llvm/include/llvm/PassSupport.h b/llvm/include/llvm/PassSupport.h --- a/llvm/include/llvm/PassSupport.h +++ b/llvm/include/llvm/PassSupport.h @@ -77,7 +77,19 @@ INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \ PassName::registerOptions(); -template Pass *callDefaultCtor() { return new PassName(); } +template {}, + bool>::type = true> +Pass *callDefaultCtor() { + return new PassName(); +} + +template {}, + bool>::type = true> +Pass *callDefaultCtor() { + return nullptr; +} //===--------------------------------------------------------------------------- /// RegisterPass template - This template class is used to notify the system diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp --- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp +++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp @@ -302,7 +302,7 @@ public: static char ID; // Pass identification, replacement for typeid - MachineCopyPropagation(bool CopyInstr = false) + MachineCopyPropagation(bool CopyInstr) : MachineFunctionPass(ID), UseCopyInstr(CopyInstr || MCPUseCopyInstr) { initializeMachineCopyPropagationPass(*PassRegistry::getPassRegistry()); } @@ -1026,7 +1026,6 @@ return Changed; } -MachineFunctionPass * -llvm::createMachineCopyPropagationPass(bool UseCopyInstr = false) { +MachineFunctionPass *llvm::createMachineCopyPropagationPass(bool UseCopyInstr) { return new MachineCopyPropagation(UseCopyInstr); } diff --git a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h --- a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h +++ b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h @@ -168,6 +168,8 @@ public: enum class AdvisorMode : int { Default, Release, Development }; + RegAllocEvictionAdvisorAnalysis() = delete; + RegAllocEvictionAdvisorAnalysis(AdvisorMode Mode) : ImmutablePass(ID), Mode(Mode){}; static char ID; diff --git a/llvm/lib/CodeGen/RegAllocPriorityAdvisor.h b/llvm/lib/CodeGen/RegAllocPriorityAdvisor.h --- a/llvm/lib/CodeGen/RegAllocPriorityAdvisor.h +++ b/llvm/lib/CodeGen/RegAllocPriorityAdvisor.h @@ -23,6 +23,7 @@ /// live ranges. class RegAllocPriorityAdvisor { public: + RegAllocPriorityAdvisor() = delete; RegAllocPriorityAdvisor(const RegAllocPriorityAdvisor &) = delete; RegAllocPriorityAdvisor(RegAllocPriorityAdvisor &&) = delete; virtual ~RegAllocPriorityAdvisor() = default; diff --git a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp @@ -46,9 +46,11 @@ public: static char ID; - explicit AArch64DAGToDAGISel(AArch64TargetMachine *tm = nullptr, - CodeGenOpt::Level OptLevel = CodeGenOpt::Default) - : SelectionDAGISel(ID, *tm, OptLevel), Subtarget(nullptr) {} + AArch64DAGToDAGISel() = delete; + + explicit AArch64DAGToDAGISel(AArch64TargetMachine &tm, + CodeGenOpt::Level OptLevel) + : SelectionDAGISel(ID, tm, OptLevel), Subtarget(nullptr) {} StringRef getPassName() const override { return PASS_NAME; } @@ -5546,7 +5548,7 @@ /// AArch64-specific DAG, ready for instruction scheduling. FunctionPass *llvm::createAArch64ISelDag(AArch64TargetMachine &TM, CodeGenOpt::Level OptLevel) { - return new AArch64DAGToDAGISel(&TM, OptLevel); + return new AArch64DAGToDAGISel(TM, OptLevel); } /// When \p PredVT is a scalable vector predicate in the form diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h @@ -93,8 +93,9 @@ public: static char ID; - explicit AMDGPUDAGToDAGISel(TargetMachine *TM = nullptr, - CodeGenOpt::Level OptLevel = CodeGenOpt::Default); + AMDGPUDAGToDAGISel() = delete; + + explicit AMDGPUDAGToDAGISel(TargetMachine &TM, CodeGenOpt::Level OptLevel); ~AMDGPUDAGToDAGISel() override = default; void getAnalysisUsage(AnalysisUsage &AU) const override; diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -171,9 +171,10 @@ public: static char ID; - explicit X86DAGToDAGISel(X86TargetMachine *tm = nullptr, - CodeGenOpt::Level OptLevel = CodeGenOpt::Default) - : SelectionDAGISel(ID, *tm, OptLevel), Subtarget(nullptr), + X86DAGToDAGISel() = delete; + + explicit X86DAGToDAGISel(X86TargetMachine &tm, CodeGenOpt::Level OptLevel) + : SelectionDAGISel(ID, tm, OptLevel), Subtarget(nullptr), OptForMinSize(false), IndirectTlsSegRefs(false) {} StringRef getPassName() const override { return PASS_NAME; } @@ -6201,5 +6202,5 @@ /// ready for instruction scheduling. FunctionPass *llvm::createX86ISelDag(X86TargetMachine &TM, CodeGenOpt::Level OptLevel) { - return new X86DAGToDAGISel(&TM, OptLevel); + return new X86DAGToDAGISel(TM, OptLevel); }