Skip to content

Commit 506a14b

Browse files
committed
COWArrayOpts: make the optimization work again for two-dimensional arrays.
With removing of pinning and with addressors, the pattern matching did not work anymore. The good thing is that the SIL is now much simpler and we can handle the 2D case without pattern matching at all. This removes a lot of code from COWArrayOpts. rdar://problem/43863081
1 parent b2a5fd6 commit 506a14b

File tree

7 files changed

+306
-1417
lines changed

7 files changed

+306
-1417
lines changed

include/swift/SIL/InstructionUtils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ SILValue stripAddressAccess(SILValue V);
5757
/// instructions.
5858
SILValue stripAddressProjections(SILValue V);
5959

60-
/// Return the underlying SILValue after stripping off all address projection
61-
/// instructions which have a single operand.
62-
SILValue stripUnaryAddressProjections(SILValue V);
63-
6460
/// Return the underlying SILValue after stripping off all aggregate projection
6561
/// instructions.
6662
///

include/swift/SILOptimizer/Utils/Local.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,6 @@ SILType getExactDynamicType(SILValue S, SILModule &M,
600600
SILType getExactDynamicTypeOfUnderlyingObject(SILValue S, SILModule &M,
601601
ClassHierarchyAnalysis *CHA);
602602

603-
/// Hoist the address projection rooted in \p Op to \p InsertBefore.
604-
/// Requires the projected value to dominate the insertion point.
605-
///
606-
/// Will look through single basic block predecessor arguments.
607-
void hoistAddressProjections(Operand &Op, SILInstruction *InsertBefore,
608-
DominanceInfo *DomTree);
609-
610603
/// Utility class for cloning init values into the static initializer of a
611604
/// SILGlobalVariable.
612605
class StaticInitCloner : public SILCloner<StaticInitCloner> {

lib/SIL/InstructionUtils.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,6 @@ SILValue swift::stripAddressProjections(SILValue V) {
203203
}
204204
}
205205

206-
SILValue swift::stripUnaryAddressProjections(SILValue V) {
207-
while (true) {
208-
V = stripSinglePredecessorArgs(V);
209-
if (!Projection::isAddressProjection(V))
210-
return V;
211-
auto *Inst = cast<SingleValueInstruction>(V);
212-
if (Inst->getNumOperands() > 1)
213-
return V;
214-
V = Inst->getOperand(0);
215-
}
216-
}
217-
218206
SILValue swift::stripValueProjections(SILValue V) {
219207
while (true) {
220208
V = stripSinglePredecessorArgs(V);

0 commit comments

Comments
 (0)