Skip to content

Commit f6e4941

Browse files
authored
Merge pull request #21877 from gottesmm/pr-2186494e202cd0077bd89580e12e7ec214a8975b
2 parents 0c59faf + 3d562e5 commit f6e4941

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

lib/SILOptimizer/Mandatory/PMOMemoryUseCollector.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,6 @@ getScalarizedElementAddresses(SILValue Pointer, SILBuilder &B, SILLocation Loc,
5959
}
6060
}
6161

62-
/// Given an RValue of aggregate type, compute the values of the elements by
63-
/// emitting a series of tuple_element instructions.
64-
static void getScalarizedElements(SILValue V,
65-
SmallVectorImpl<SILValue> &ElementVals,
66-
SILLocation Loc, SILBuilder &B) {
67-
TupleType *TT = V->getType().castTo<TupleType>();
68-
for (auto Index : indices(TT->getElements())) {
69-
ElementVals.push_back(B.emitTupleExtract(Loc, V, Index));
70-
}
71-
}
72-
7362
/// Scalarize a load down to its subelements. If NewLoads is specified, this
7463
/// can return the newly generated sub-element loads.
7564
static SILValue scalarizeLoad(LoadInst *LI,
@@ -442,8 +431,9 @@ bool ElementUseCollector::collectUses(SILValue Pointer) {
442431
// Scalarize StoreInst
443432
if (auto *SI = dyn_cast<StoreInst>(User)) {
444433
SILBuilderWithScope B(User, SI);
445-
getScalarizedElements(SI->getOperand(0), ElementTmps, SI->getLoc(), B);
446-
434+
B.emitDestructureValueOperation(
435+
SI->getLoc(), SI->getSrc(),
436+
[&](unsigned index, SILValue v) { ElementTmps.push_back(v); });
447437
for (unsigned i = 0, e = ElementAddrs.size(); i != e; ++i)
448438
B.createTrivialStoreOr(SI->getLoc(), ElementTmps[i], ElementAddrs[i],
449439
SI->getOwnershipQualifier(),

0 commit comments

Comments
 (0)