@@ -1020,11 +1020,9 @@ static void replaceUndefValuesInPhi(PHINode *PN,
1020
1020
// Only when they shares a single common predecessor, return true.
1021
1021
// Only handles cases when BB can't be merged while its predecessors can be
1022
1022
// redirected.
1023
- // \p SuccPredsOut may be partially populated with the predecessors of Succ.
1024
1023
static bool
1025
1024
CanRedirectPredsOfEmptyBBToSucc (BasicBlock *BB, BasicBlock *Succ,
1026
1025
const SmallPtrSetImpl<BasicBlock *> &BBPreds,
1027
- SmallPtrSetImpl<BasicBlock *> &SuccPredsOut,
1028
1026
BasicBlock *&CommonPred) {
1029
1027
1030
1028
// There must be phis in BB, otherwise BB will be merged into Succ directly
@@ -1044,7 +1042,6 @@ CanRedirectPredsOfEmptyBBToSucc(BasicBlock *BB, BasicBlock *Succ,
1044
1042
// Get the single common predecessor of both BB and Succ. Return false
1045
1043
// when there are more than one common predecessors.
1046
1044
for (BasicBlock *SuccPred : predecessors (Succ)) {
1047
- SuccPredsOut.insert (SuccPred);
1048
1045
if (BBPreds.count (SuccPred)) {
1049
1046
if (CommonPred)
1050
1047
return false ;
@@ -1168,7 +1165,6 @@ bool llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB,
1168
1165
return false ;
1169
1166
1170
1167
SmallPtrSet<BasicBlock *, 16 > BBPreds (pred_begin (BB), pred_end (BB));
1171
- SmallPtrSet<BasicBlock *, 16 > SuccPreds;
1172
1168
1173
1169
// The single common predecessor of BB and Succ when BB cannot be killed
1174
1170
BasicBlock *CommonPred = nullptr ;
@@ -1177,16 +1173,13 @@ bool llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB,
1177
1173
1178
1174
// Even if we can not fold BB into Succ, we may be able to redirect the
1179
1175
// predecessors of BB to Succ.
1180
- bool BBPhisMergeable =
1181
- BBKillable ||
1182
- CanRedirectPredsOfEmptyBBToSucc (BB, Succ, BBPreds, SuccPreds, CommonPred);
1176
+ bool BBPhisMergeable = BBKillable || CanRedirectPredsOfEmptyBBToSucc (
1177
+ BB, Succ, BBPreds, CommonPred);
1183
1178
1184
1179
if ((!BBKillable && !BBPhisMergeable) || introduceTooManyPhiEntries (BB, Succ))
1185
1180
return false ;
1186
1181
1187
- // SuccPreds may not have been fully filled by CanRedirectPredsOfEmptyBBToSucc
1188
- // so finish it here.
1189
- SuccPreds.insert (pred_begin (Succ), pred_end (Succ));
1182
+ SmallPtrSet<BasicBlock *, 16 > SuccPreds (pred_begin (Succ), pred_end (Succ));
1190
1183
1191
1184
// Check to see if merging these blocks/phis would cause conflicts for any of
1192
1185
// the phi nodes in BB or Succ. If not, we can safely merge.
0 commit comments