Skip to content

Commit a8c4cc6

Browse files
committed
[gardening] Rename ValueBase::getParentBB() => getParentBlock().
1 parent c6c9914 commit a8c4cc6

File tree

17 files changed

+37
-37
lines changed

17 files changed

+37
-37
lines changed

include/swift/SIL/SILValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class alignas(8) ValueBase : public SILAllocated<ValueBase> {
121121

122122
/// If this is a SILArgument or a SILInstruction get its parent basic block,
123123
/// otherwise return null.
124-
SILBasicBlock *getParentBB() const;
124+
SILBasicBlock *getParentBlock() const;
125125

126126
/// If this is a SILArgument or a SILInstruction get its parent function,
127127
/// otherwise return null.

include/swift/SILOptimizer/Analysis/EpilogueARCAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class EpilogueARCAnalysis : public FunctionAnalysisBase<EpilogueARCFunctionInfo>
279279
virtual void handleDeleteNotification(ValueBase *V) override {
280280
// If the parent function of this instruction was just turned into an
281281
// external declaration, bail. This happens during SILFunction destruction.
282-
SILFunction *F = V->getParentBB()->getParent();
282+
SILFunction *F = V->getFunction();
283283
if (F->isExternalDeclaration()) {
284284
return;
285285
}

include/swift/SILOptimizer/Analysis/RCIdentityAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class RCIdentityAnalysis : public FunctionAnalysisBase<RCIdentityFunctionInfo> {
8787
virtual void handleDeleteNotification(ValueBase *V) override {
8888
// If the parent function of this instruction was just turned into an
8989
// external declaration, bail. This happens during SILFunction destruction.
90-
SILFunction *F = V->getParentBB()->getParent();
90+
SILFunction *F = V->getFunction();
9191
if (F->isExternalDeclaration()) {
9292
return;
9393
}

lib/SIL/SILPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ ID SILPrinter::getID(SILValue V) {
16831683

16841684
// Lazily initialize the instruction -> ID mapping.
16851685
if (ValueToIDMap.empty()) {
1686-
V->getParentBB()->getParent()->numberValues(ValueToIDMap);
1686+
V->getParentBlock()->getParent()->numberValues(ValueToIDMap);
16871687
}
16881688

16891689
ID R = { ID::SSAValue, ValueToIDMap[V] };

lib/SIL/SILValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static_assert(sizeof(SILValue) == sizeof(uintptr_t),
3131
// Utility Methods
3232
//===----------------------------------------------------------------------===//
3333

34-
SILBasicBlock *ValueBase::getParentBB() const {
34+
SILBasicBlock *ValueBase::getParentBlock() const {
3535
auto *NonConstThis = const_cast<ValueBase *>(this);
3636
if (auto *Inst = dyn_cast<SILInstruction>(NonConstThis))
3737
return Inst->getParent();

lib/SILOptimizer/Analysis/ARCAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ bool swift::getFinalReleasesForValue(SILValue V, ReleaseTracker &Tracker) {
925925
llvm::SmallPtrSet<SILBasicBlock *, 16> UseBlocks;
926926

927927
// First attempt to get the BB where this value resides.
928-
auto *DefBB = V->getParentBB();
928+
auto *DefBB = V->getParentBlock();
929929
if (!DefBB)
930930
return false;
931931

lib/SILOptimizer/Analysis/ArraySemantic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static bool canHoistArrayArgument(ApplyInst *SemanticsCall, SILValue Arr,
257257
return false;
258258

259259
ValueBase *SelfVal = Arr;
260-
auto *SelfBB = SelfVal->getParentBB();
260+
auto *SelfBB = SelfVal->getParentBlock();
261261
if (DT->dominates(SelfBB, InsertBefore->getParent()))
262262
return true;
263263

@@ -267,7 +267,7 @@ static bool canHoistArrayArgument(ApplyInst *SemanticsCall, SILValue Arr,
267267
auto Val = LI->getOperand();
268268
bool DoesNotDominate;
269269
StructElementAddrInst *SEI;
270-
while ((DoesNotDominate = !DT->dominates(Val->getParentBB(),
270+
while ((DoesNotDominate = !DT->dominates(Val->getParentBlock(),
271271
InsertBefore->getParent())) &&
272272
(SEI = dyn_cast<StructElementAddrInst>(Val)))
273273
Val = SEI->getOperand();
@@ -325,7 +325,7 @@ bool swift::ArraySemanticsCall::canHoist(SILInstruction *InsertBefore,
325325
static SILValue copyArrayLoad(SILValue ArrayStructValue,
326326
SILInstruction *InsertBefore,
327327
DominanceInfo *DT) {
328-
if (DT->dominates(ArrayStructValue->getParentBB(),
328+
if (DT->dominates(ArrayStructValue->getParentBlock(),
329329
InsertBefore->getParent()))
330330
return ArrayStructValue;
331331

@@ -334,7 +334,7 @@ static SILValue copyArrayLoad(SILValue ArrayStructValue,
334334
// Recursively move struct_element_addr.
335335
ValueBase *Val = LI->getOperand();
336336
auto *InsertPt = InsertBefore;
337-
while (!DT->dominates(Val->getParentBB(), InsertBefore->getParent())) {
337+
while (!DT->dominates(Val->getParentBlock(), InsertBefore->getParent())) {
338338
auto *Inst = cast<StructElementAddrInst>(Val);
339339
Inst->moveBefore(InsertPt);
340340
Val = Inst->getOperand();

lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,8 +1842,8 @@ bool EscapeAnalysis::canEscapeTo(SILValue V, RefCountingInst *RI) {
18421842

18431843
/// Utility to get the function which contains both values \p V1 and \p V2.
18441844
static SILFunction *getCommonFunction(SILValue V1, SILValue V2) {
1845-
SILBasicBlock *BB1 = V1->getParentBB();
1846-
SILBasicBlock *BB2 = V2->getParentBB();
1845+
SILBasicBlock *BB1 = V1->getParentBlock();
1846+
SILBasicBlock *BB2 = V2->getParentBlock();
18471847
if (!BB1 || !BB2)
18481848
return nullptr;
18491849

@@ -1968,7 +1968,7 @@ void EscapeAnalysis::invalidate(SILFunction *F, InvalidationKind K) {
19681968
}
19691969

19701970
void EscapeAnalysis::handleDeleteNotification(ValueBase *I) {
1971-
if (SILBasicBlock *Parent = I->getParentBB()) {
1971+
if (SILBasicBlock *Parent = I->getParentBlock()) {
19721972
SILFunction *F = Parent->getParent();
19731973
if (FunctionInfo *FInfo = Function2Info.lookup(F)) {
19741974
if (FInfo->isValid()) {

lib/SILOptimizer/Analysis/RCIdentityAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static SILValue stripRCIdentityPreservingInsts(SILValue V) {
131131
/// dominates the BB of A.
132132
static bool dominatesArgument(DominanceInfo *DI, SILArgument *A,
133133
SILValue FirstIV) {
134-
SILBasicBlock *OtherBB = FirstIV->getParentBB();
134+
SILBasicBlock *OtherBB = FirstIV->getParentBlock();
135135
if (!OtherBB || OtherBB == A->getParent())
136136
return false;
137137
return DI->dominates(OtherBB, A->getParent());
@@ -190,7 +190,7 @@ findDominatingNonPayloadedEdge(SILBasicBlock *IncomingEdgeBB,
190190
SILValue RCIdentity) {
191191
// First grab the NonPayloadedEnumBB and RCIdentityBB. If we cannot find
192192
// either of them, return false.
193-
SILBasicBlock *RCIdentityBB = RCIdentity->getParentBB();
193+
SILBasicBlock *RCIdentityBB = RCIdentity->getParentBlock();
194194
if (!RCIdentityBB)
195195
return false;
196196

lib/SILOptimizer/LoopTransforms/ArrayBoundsCheckOpts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ static bool isRangeChecked(SILValue Start, SILValue End,
689689
}
690690

691691
static bool dominates(DominanceInfo *DT, SILValue V, SILBasicBlock *B) {
692-
if (auto ValueBB = V->getParentBB())
692+
if (auto ValueBB = V->getParentBlock())
693693
return DT->dominates(ValueBB, B);
694694
return false;
695695
}

lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,11 +1012,11 @@ struct HoistableMakeMutable {
10121012
MakeMutable = M;
10131013

10141014
// The function_ref needs to be invariant.
1015-
if (Loop->contains(MakeMutable->getCallee()->getParentBB()))
1015+
if (Loop->contains(MakeMutable->getCallee()->getParentBlock()))
10161016
return;
10171017

10181018
// The array reference is invariant.
1019-
if (!L->contains(M.getSelf()->getParentBB())) {
1019+
if (!L->contains(M.getSelf()->getParentBlock())) {
10201020
IsHoistable = true;
10211021
return;
10221022
}
@@ -1094,7 +1094,7 @@ struct HoistableMakeMutable {
10941094

10951095
SILValue ArrayBuffer = stripValueProjections(UncheckedRefCast->getOperand(), DepInsts);
10961096
auto *BaseLoad = dyn_cast<LoadInst>(ArrayBuffer);
1097-
if (!BaseLoad || Loop->contains(BaseLoad->getOperand()->getParentBB()))
1097+
if (!BaseLoad || Loop->contains(BaseLoad->getOperand()->getParentBlock()))
10981098
return false;
10991099
DepInsts.push_back(BaseLoad);
11001100

@@ -1105,15 +1105,15 @@ struct HoistableMakeMutable {
11051105
GetElementAddrCall.getKind() != ArrayCallKind::kGetElementAddress)
11061106
return false;
11071107
if (Loop->contains(
1108-
((ApplyInst *)GetElementAddrCall)->getCallee()->getParentBB()))
1108+
((ApplyInst *)GetElementAddrCall)->getCallee()->getParentBlock()))
11091109
return false;
1110-
if (Loop->contains(GetElementAddrCall.getIndex()->getParentBB()))
1110+
if (Loop->contains(GetElementAddrCall.getIndex()->getParentBlock()))
11111111
return false;
11121112

11131113
auto *GetElementAddrArrayLoad =
11141114
dyn_cast<LoadInst>(GetElementAddrCall.getSelf());
11151115
if (!GetElementAddrArrayLoad ||
1116-
Loop->contains(GetElementAddrArrayLoad->getOperand()->getParentBB()))
1116+
Loop->contains(GetElementAddrArrayLoad->getOperand()->getParentBlock()))
11171117
return false;
11181118

11191119
// Check the retain/release around the get_element_addr call.
@@ -1140,18 +1140,18 @@ struct HoistableMakeMutable {
11401140
if (CheckSubscript.getKind() == ArrayCallKind::kMakeMutable)
11411141
return true;
11421142

1143-
if (Loop->contains(CheckSubscript.getIndex()->getParentBB()) ||
1143+
if (Loop->contains(CheckSubscript.getIndex()->getParentBlock()) ||
11441144
Loop->contains(CheckSubscript.getArrayPropertyIsNativeTypeChecked()
1145-
->getParentBB()))
1145+
->getParentBlock()))
11461146
return false;
11471147

11481148
auto *CheckSubscriptArrayLoad =
11491149
dyn_cast<LoadInst>(CheckSubscript.getSelf());
11501150
if (!CheckSubscript ||
1151-
Loop->contains(CheckSubscriptArrayLoad->getOperand()->getParentBB()))
1151+
Loop->contains(CheckSubscriptArrayLoad->getOperand()->getParentBlock()))
11521152
return false;
11531153
if (Loop->contains(
1154-
((ApplyInst *)CheckSubscript)->getCallee()->getParentBB()))
1154+
((ApplyInst *)CheckSubscript)->getCallee()->getParentBlock()))
11551155
return false;
11561156

11571157
// The array must match get_element_addr's array.
@@ -1460,7 +1460,7 @@ bool COWArrayOpt::hoistMakeMutable(ArraySemanticsCall MakeMutable) {
14601460
// We can hoist address projections (even if they are only conditionally
14611461
// executed).
14621462
auto ArrayAddrBase = stripUnaryAddressProjections(CurrentArrayAddr);
1463-
SILBasicBlock *ArrayAddrBaseBB = ArrayAddrBase->getParentBB();
1463+
SILBasicBlock *ArrayAddrBaseBB = ArrayAddrBase->getParentBlock();
14641464

14651465
if (ArrayAddrBaseBB && !DomTree->dominates(ArrayAddrBaseBB, Preheader)) {
14661466
DEBUG(llvm::dbgs() << " Skipping Array: does not dominate loop!\n");
@@ -2043,7 +2043,7 @@ class RegionCloner : public SILCloner<RegionCloner> {
20432043
}
20442044

20452045
SILValue remapValue(SILValue V) {
2046-
if (auto *BB = V->getParentBB()) {
2046+
if (auto *BB = V->getParentBlock()) {
20472047
if (!DomTree.dominates(StartBB, BB)) {
20482048
// Must be a value that dominates the start basic block.
20492049
assert(DomTree.dominates(BB, StartBB) &&

lib/SILOptimizer/LoopTransforms/LICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static bool sinkFixLifetime(SILLoop *Loop, DominanceInfo *DomTree,
348348
// Sink the fix_lifetime instruction.
349349
bool Changed = false;
350350
for (auto *FLI : FixLifetimeInsts)
351-
if (DomTree->dominates(FLI->getOperand()->getParentBB(),
351+
if (DomTree->dominates(FLI->getOperand()->getParentBlock(),
352352
Preheader)) {
353353
auto Succs = ExitingBB->getSuccessors();
354354
for (unsigned EdgeIdx = 0; EdgeIdx < Succs.size(); ++EdgeIdx) {

lib/SILOptimizer/LoopTransforms/LoopUnroll.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LoopCloner : public SILCloner<LoopCloner> {
5656

5757
protected:
5858
SILValue remapValue(SILValue V) {
59-
if (auto *BB = V->getParentBB()) {
59+
if (auto *BB = V->getParentBlock()) {
6060
if (!Loop->contains(BB))
6161
return V;
6262
}
@@ -314,9 +314,9 @@ updateSSA(SILLoop *Loop,
314314
UseList.push_back(UseWrapper(Use));
315315
// Update SSA of use with the available values.
316316
SSAUp.Initialize(OrigValue->getType());
317-
SSAUp.AddAvailableValue(OrigValue->getParentBB(), OrigValue);
317+
SSAUp.AddAvailableValue(OrigValue->getParentBlock(), OrigValue);
318318
for (auto NewValue : MapEntry.second)
319-
SSAUp.AddAvailableValue(NewValue->getParentBB(), NewValue);
319+
SSAUp.AddAvailableValue(NewValue->getParentBlock(), NewValue);
320320
for (auto U : UseList) {
321321
Operand *Use = U;
322322
SSAUp.RewriteUse(*Use);

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ runOnFunctionRecursively(SILFunction *F, FullApplySite AI,
360360
if (auto *II = dyn_cast<SILInstruction>(NewInst))
361361
I = II->getIterator();
362362
else
363-
I = NewInst->getParentBB()->begin();
363+
I = NewInst->getParentBlock()->begin();
364364
auto NewAI = FullApplySite::isa(NewInstPair.second.getInstruction());
365365
if (!NewAI)
366366
continue;

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,7 @@ static void tryToReplaceArgWithIncomingValue(SILBasicBlock *BB, unsigned i,
33573357
// If the incoming values of all predecessors are equal usually this means
33583358
// that the common incoming value dominates the BB. But: this might be not
33593359
// the case if BB is unreachable. Therefore we still have to check it.
3360-
if (!DT->dominates(V->getParentBB(), BB))
3360+
if (!DT->dominates(V->getParentBlock(), BB))
33613361
return;
33623362

33633363
// An argument has one result value. We need to replace this with the *value*

lib/SILOptimizer/Utils/CheckedCastBrJumpThreading.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ SILValue CheckedCastBrJumpThreading::isArgValueEquivalentToCondition(
200200
if (Def != Value)
201201
return SILValue();
202202

203-
if (!DT->dominates(DomBB, Value->getParentBB()))
203+
if (!DT->dominates(DomBB, Value->getParentBlock()))
204204
return SILValue();
205205
// OK, this value is a potential candidate
206206
}

lib/SILOptimizer/Utils/Local.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ bool swift::tryDeleteDeadClosure(SILInstruction *Closure,
11601160
void ValueLifetimeAnalysis::propagateLiveness() {
11611161
assert(LiveBlocks.empty() && "frontier computed twice");
11621162

1163-
auto DefBB = DefValue->getParentBB();
1163+
auto DefBB = DefValue->getParentBlock();
11641164
llvm::SmallVector<SILBasicBlock *, 64> Worklist;
11651165

11661166
// Find the initial set of blocks where the value is live, because
@@ -2759,7 +2759,7 @@ void swift::hoistAddressProjections(Operand &Op, SILInstruction *InsertBefore,
27592759
continue;
27602760
}
27612761
default:
2762-
assert(DomTree->dominates(V->getParentBB(), InsertBefore->getParent()) &&
2762+
assert(DomTree->dominates(V->getParentBlock(), InsertBefore->getParent()) &&
27632763
"The projected value must dominate the insertion point");
27642764
return;
27652765
}

0 commit comments

Comments
 (0)