From: Roman Lebedev Date: Wed, 15 Jul 2020 22:39:37 +0000 (+0300) Subject: [NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90c1b0442a031d6cad686fdc4e5d3db03c3603a6;p=platform%2Fupstream%2Fllvm.git [NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init Likewise, just use the builder pattern. Taking multiple params is unmaintainable. --- diff --git a/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h b/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h index 42df3af..9855400 100644 --- a/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h +++ b/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h @@ -21,29 +21,15 @@ namespace llvm { class AssumptionCache; struct SimplifyCFGOptions { - int BonusInstThreshold; - bool ForwardSwitchCondToPhi; - bool ConvertSwitchToLookupTable; - bool NeedCanonicalLoop; - bool SinkCommonInsts; - bool SimplifyCondBranch; - bool FoldTwoEntryPHINode; + int BonusInstThreshold = 1; + bool ForwardSwitchCondToPhi = false; + bool ConvertSwitchToLookupTable = false; + bool NeedCanonicalLoop = true; + bool SinkCommonInsts = false; + bool SimplifyCondBranch = true; + bool FoldTwoEntryPHINode = true; - 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) {} + AssumptionCache *AC = nullptr; // 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 4182966..3c375e0 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, {2}); + simplifyCFG(BB, TTI, SimplifyCFGOptions().bonusInstThreshold(2)); } return NewRetBlock;