[llvm] 90c1b04 - [NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 15:49:06 PDT 2020
Author: Roman Lebedev
Date: 2020-07-16T01:48:34+03:00
New Revision: 90c1b0442a031d6cad686fdc4e5d3db03c3603a6
URL: https://github.com/llvm/llvm-project/commit/90c1b0442a031d6cad686fdc4e5d3db03c3603a6
DIFF: https://github.com/llvm/llvm-project/commit/90c1b0442a031d6cad686fdc4e5d3db03c3603a6.diff
LOG: [NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init
Likewise, just use the builder pattern.
Taking multiple params is unmaintainable.
Added:
Modified:
llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h
llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h b/llvm/include/llvm/Transforms/Scalar/SimplifyCFGOptions.h
index 42df3af5d747..9855400a2bae 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 418296684d76..3c375e057525 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;
More information about the llvm-commits
mailing list