Skip to content

Commit 132d49f

Browse files
committed
ARCSequenceOpts: Minor code consolidation
1 parent ce669ca commit 132d49f

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

lib/SILOptimizer/ARC/ARCRegionState.cpp

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,21 @@ void ARCRegionState::mergePredTopDown(ARCRegionState &PredRegionState) {
156156
// Bottom Up Dataflow
157157
//
158158

159-
static bool processBlockBottomUpInsts(
160-
ARCRegionState &State, SILBasicBlock &BB,
161-
BottomUpDataflowRCStateVisitor<ARCRegionState> &DataflowVisitor,
162-
AliasAnalysis *AA, ImmutablePointerSetFactory<SILInstruction> &SetFactory) {
159+
bool ARCRegionState::processBlockBottomUp(
160+
const LoopRegion *R, AliasAnalysis *AA, RCIdentityFunctionInfo *RCIA,
161+
EpilogueARCFunctionInfo *EAFI, LoopRegionFunctionInfo *LRFI,
162+
bool FreezeOwnedArgEpilogueReleases,
163+
BlotMapVector<SILInstruction *, BottomUpRefCountState> &IncToDecStateMap,
164+
ImmutablePointerSetFactory<SILInstruction> &SetFactory) {
165+
LLVM_DEBUG(llvm::dbgs() << ">>>> Bottom Up!\n");
163166

164-
auto II = State.summarizedinterestinginsts_rbegin();
165-
auto IE = State.summarizedinterestinginsts_rend();
167+
SILBasicBlock &BB = *R->getBlock();
168+
BottomUpDataflowRCStateVisitor<ARCRegionState> DataflowVisitor(
169+
RCIA, EAFI, *this, FreezeOwnedArgEpilogueReleases, IncToDecStateMap,
170+
SetFactory);
171+
172+
auto II = summarizedinterestinginsts_rbegin();
173+
auto IE = summarizedinterestinginsts_rend();
166174

167175
// If we do not have any interesting instructions, bail and return false since
168176
// we can not have any nested instructions.
@@ -198,7 +206,7 @@ static bool processBlockBottomUpInsts(
198206

199207
// For all other (reference counted value, ref count state) we are
200208
// tracking...
201-
for (auto &OtherState : State.getBottomupStates()) {
209+
for (auto &OtherState : getBottomupStates()) {
202210
// If the other state's value is blotted, skip it.
203211
if (!OtherState.hasValue())
204212
continue;
@@ -215,26 +223,6 @@ static bool processBlockBottomUpInsts(
215223
return NestingDetected;
216224
}
217225

218-
bool ARCRegionState::processBlockBottomUp(
219-
const LoopRegion *R, AliasAnalysis *AA, RCIdentityFunctionInfo *RCIA,
220-
EpilogueARCFunctionInfo *EAFI, LoopRegionFunctionInfo *LRFI,
221-
bool FreezeOwnedArgEpilogueReleases,
222-
BlotMapVector<SILInstruction *, BottomUpRefCountState> &IncToDecStateMap,
223-
ImmutablePointerSetFactory<SILInstruction> &SetFactory) {
224-
LLVM_DEBUG(llvm::dbgs() << ">>>> Bottom Up!\n");
225-
226-
SILBasicBlock &BB = *R->getBlock();
227-
BottomUpDataflowRCStateVisitor<ARCRegionState> DataflowVisitor(
228-
RCIA, EAFI, *this, FreezeOwnedArgEpilogueReleases, IncToDecStateMap,
229-
SetFactory);
230-
231-
// Visit each arc relevant instruction I in BB visited in reverse...
232-
bool NestingDetected =
233-
processBlockBottomUpInsts(*this, BB, DataflowVisitor, AA, SetFactory);
234-
235-
return NestingDetected;
236-
}
237-
238226
// Returns true if any of the non-local successors of the region are leaking
239227
// blocks. We currently do not handle early exits, but do handle trapping
240228
// blocks. Returns false if otherwise

lib/SILOptimizer/ARC/ARCRegionState.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,6 @@ class ARCRegionState {
219219
void removeInterestingInst(SILInstruction *I);
220220

221221
private:
222-
void processBlockBottomUpPredTerminators(
223-
const LoopRegion *R, AliasAnalysis *AA, LoopRegionFunctionInfo *LRFI,
224-
ImmutablePointerSetFactory<SILInstruction> &SetFactory);
225222
bool processBlockBottomUp(
226223
const LoopRegion *R, AliasAnalysis *AA, RCIdentityFunctionInfo *RCIA,
227224
EpilogueARCFunctionInfo *EAFI,

0 commit comments

Comments
 (0)