[llvm] 5831e86 - Revert "[NFC] SimplifyCFGOptions: drop multi-parameter ctor, use default member-init"

Adrian Kuegel via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 01:51:14 PDT 2020


Author: Adrian Kuegel
Date: 2020-07-16T10:32:50+02:00
New Revision: 5831e86190966d58385678eb74b26aefacbfd101

URL: https://github.com/llvm/llvm-project/commit/5831e86190966d58385678eb74b26aefacbfd101
DIFF: https://github.com/llvm/llvm-project/commit/5831e86190966d58385678eb74b26aefacbfd101.diff

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

This reverts commit 90c1b0442a031d6cad686fdc4e5d3db03c3603a6.
This is based on another commit which also needs to be reverted.
The other commit introduced a Dependency Cycle between Transforms/Scalar
and TransformUtils. Scalar already depends (in many ways) on
TransformUtils, so making TransformUtils depend on Scalar should be
avoided.

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 9855400a2bae..42df3af5d747 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 3c375e057525..418296684d76 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;


        


More information about the llvm-commits mailing list