Skip to content

Enable COWArrayOpts on OSSA #35312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ class SILInstruction
SILValue getOperand(unsigned Num) const {
return getAllOperands()[Num].get();
}
Operand &getOperandRef(unsigned Num) { return getAllOperands()[Num]; }
void setOperand(unsigned Num, SILValue V) { getAllOperands()[Num].set(V); }
void swapOperands(unsigned Num1, unsigned Num2) {
getAllOperands()[Num1].swap(getAllOperands()[Num2]);
Expand Down
4 changes: 4 additions & 0 deletions lib/SILOptimizer/LoopTransforms/ArrayOpt.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ class StructUseCollector {
if (!ElementAddressUsers.empty())
return false;
for (SILInstruction *user : StructAddressUsers) {
// ignore load users
if (isa<LoadInst>(user))
continue;
if (user != use1 && user != use2)
return false;
}
Expand Down Expand Up @@ -184,6 +187,7 @@ class StructUseCollector {
// Found a use of the struct at the given access path.
if (auto *LoadI = dyn_cast<LoadInst>(UseInst)) {
StructLoads.push_back(LoadI);
StructAddressUsers.push_back(LoadI);
continue;
}

Expand Down
Loading