Skip to content

Commit 26955f3

Browse files
committed
[SimplifyCFG] Don't limit the number of simultaneous forwards from switch condition
1 parent 5ddd19a commit 26955f3

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5818,8 +5818,6 @@ static bool ForwardSwitchConditionToPHI(SwitchInst *SI) {
58185818
for (auto &ForwardingNode : ForwardingNodes) {
58195819
PHINode *Phi = ForwardingNode.first;
58205820
SmallVectorImpl<int> &Indexes = ForwardingNode.second;
5821-
if (Indexes.size() < 2)
5822-
continue;
58235821

58245822
for (int Index : Indexes)
58255823
Phi->setIncomingValue(Index, SI->getCondition());

llvm/test/Transforms/SimplifyCFG/ForwardSwitchConditionToPHI.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ define i32 @forward_one(i32 %m) {
9797
; FWD: sw.bb4:
9898
; FWD-NEXT: br label [[RETURN]]
9999
; FWD: return:
100-
; FWD-NEXT: [[RETVAL_0:%.*]] = phi i32 [ 4, [[SW_BB4]] ], [ 5, [[SW_BB3]] ], [ 6, [[SW_BB2]] ], [ 1, [[SW_BB1]] ], [ 8, [[ENTRY:%.*]] ]
100+
; FWD-NEXT: [[RETVAL_0:%.*]] = phi i32 [ 4, [[SW_BB4]] ], [ 5, [[SW_BB3]] ], [ 6, [[SW_BB2]] ], [ [[M]], [[SW_BB1]] ], [ 8, [[ENTRY:%.*]] ]
101101
; FWD-NEXT: ret i32 [[RETVAL_0]]
102102
;
103103
entry:

0 commit comments

Comments
 (0)