Skip to content

Commit f7ca26c

Browse files
committed
[NFC] SIL: This utility takes a func not a module.
In preparation to use the function in the implementation.
1 parent 36859c0 commit f7ca26c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

include/swift/SIL/MemAccessUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ struct AccessPathWithBase {
12811281
//
12821282
// Returns false if the access path couldn't be computed.
12831283
bool visitProductLeafAccessPathNodes(
1284-
SILValue address, TypeExpansionContext tec, SILModule &module,
1284+
SILValue address, TypeExpansionContext tec, SILFunction &function,
12851285
std::function<void(AccessPath::PathNode, SILType)> visitor);
12861286

12871287
inline AccessPath AccessPath::compute(SILValue address) {

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ AccessPathWithBase AccessPathWithBase::computeInScope(SILValue address) {
14371437
}
14381438

14391439
bool swift::visitProductLeafAccessPathNodes(
1440-
SILValue address, TypeExpansionContext tec, SILModule &module,
1440+
SILValue address, TypeExpansionContext tec, SILFunction &function,
14411441
std::function<void(AccessPath::PathNode, SILType)> visitor) {
14421442
auto rootPath = AccessPath::compute(address);
14431443
if (!rootPath.isValid()) {
@@ -1469,7 +1469,8 @@ bool swift::visitProductLeafAccessPathNodes(
14691469
for (auto *field : decl->getStoredProperties()) {
14701470
auto *fieldNode = node->getChild(index);
14711471
worklist.push_back(
1472-
{silType.getFieldType(field, module, tec), fieldNode});
1472+
{silType.getFieldType(field, function.getModule(), tec),
1473+
fieldNode});
14731474
++index;
14741475
}
14751476
} else {

lib/SILOptimizer/Transforms/DestroyAddrHoisting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ bool HoistDestroys::foldBarrier(SILInstruction *barrier,
604604
SmallPtrSet<AccessPath::PathNode, 16> trivialLeaves;
605605

606606
bool succeeded = visitProductLeafAccessPathNodes(
607-
storageRoot, typeExpansionContext, module,
607+
storageRoot, typeExpansionContext, *function,
608608
[&](AccessPath::PathNode node, SILType ty) {
609609
if (ty.isTrivial(*function))
610610
return;
@@ -765,7 +765,7 @@ bool HoistDestroys::checkFoldingBarrier(
765765
bool alreadySawLeaf = false;
766766
bool alreadySawTrivialSubleaf = false;
767767
auto succeeded = visitProductLeafAccessPathNodes(
768-
address, typeExpansionContext, module,
768+
address, typeExpansionContext, *function,
769769
[&](AccessPath::PathNode node, SILType ty) {
770770
if (ty.isTrivial(*function)) {
771771
bool inserted = !trivialLeaves.insert(node).second;

0 commit comments

Comments
 (0)