diff --git a/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h b/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h index 9855400a2bae0a..42df3af5d74773 100644 --- a/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h +++ b/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h @@ -21,15 +21,29 @@ namespace llvm { class AssumptionCache; struct SimplifyCFGOptions { - int BonusInstThreshold = 1; - bool ForwardSwitchCondToPhi = false; - bool ConvertSwitchToLookupTable = false; - bool NeedCanonicalLoop = true; - bool SinkCommonInsts = false; - bool SimplifyCondBranch = true; - bool FoldTwoEntryPHINode = true; + int BonusInstThreshold; + bool ForwardSwitchCondToPhi; + bool ConvertSwitchToLookupTable; + bool NeedCanonicalLoop; + bool SinkCommonInsts; + bool SimplifyCondBranch; + bool FoldTwoEntryPHINode; - AssumptionCache *AC = nullptr; + AssumptionCache *AC; + + SimplifyCFGOptions(unsigned BonusThreshold = 1, + bool ForwardSwitchCond = false, + bool SwitchToLookup = false, bool CanonicalLoops = true, + bool SinkCommon = false, + AssumptionCache *AssumpCache = nullptr, + bool SimplifyCondBranch = true, + bool FoldTwoEntryPHINode = true) + : BonusInstThreshold(BonusThreshold), + ForwardSwitchCondToPhi(ForwardSwitchCond), + ConvertSwitchToLookupTable(SwitchToLookup), + NeedCanonicalLoop(CanonicalLoops), SinkCommonInsts(SinkCommon), + SimplifyCondBranch(SimplifyCondBranch), + FoldTwoEntryPHINode(FoldTwoEntryPHINode), AC(AssumpCache) {} // Support 'builder' pattern to set members by name at construction time. SimplifyCFGOptions &bonusInstThreshold(int I) { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp index 3c375e05752553..418296684d765a 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp @@ -187,7 +187,7 @@ static BasicBlock *unifyReturnBlockSet(Function &F, for (BasicBlock *BB : ReturningBlocks) { // Cleanup possible branch to unconditional branch to the return. - simplifyCFG(BB, TTI, SimplifyCFGOptions().bonusInstThreshold(2)); + simplifyCFG(BB, TTI, {2}); } return NewRetBlock;