[llvm] 4028409 - Reland "[NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init"

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 03:40:28 PDT 2020


Author: Roman Lebedev
Date: 2020-07-16T13:40:01+03:00
New Revision: 4028409d77f9ea77cec115104409cca605841728

URL: https://github.com/llvm/llvm-project/commit/4028409d77f9ea77cec115104409cca605841728
DIFF: https://github.com/llvm/llvm-project/commit/4028409d77f9ea77cec115104409cca605841728.diff

LOG: Reland "[NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init"

This reverts commit 5831e86190966d58385678eb74b26aefacbfd101,
which reverted commit 90c1b0442a031d6cad686fdc4e5d3db03c3603a6
in preparation for reverting
commit b2018198c32a0535bb1f5bb5b40fbcf50d8d47b7 in
commit 1067d3e176ea7b0b1942c163bf8c6c90107768c1 due to the introducton
of a dependency cycle.

Now that the other revert is reverted with a fix, this can be relanded.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h
    llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h b/llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h
index 75cd2582f998..ca9a7e7223db 100644
--- a/llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h
+++ b/llvm/include/llvm/Transforms/Utils/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