Skip to content

Commit 4ff6f65

Browse files
authored
Merge pull request swiftlang#22263 from gottesmm/pr-494c2f53a3e49d449c234bc59b37dd3f34a4451f
2 parents 71d7aa6 + d78e83c commit 4ff6f65

27 files changed

+117
-58
lines changed

lib/SILOptimizer/ARC/ARCSequenceOpts.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,15 @@ class ARCSequenceOpts : public SILFunctionTransform {
265265
/// The entry point to the transformation.
266266
void run() override {
267267
auto *F = getFunction();
268+
268269
// If ARC optimizations are disabled, don't optimize anything and bail.
269270
if (!getOptions().EnableARCOptimizations)
270271
return;
271272

273+
// FIXME: We should support ownership.
274+
if (F->hasOwnership())
275+
return;
276+
272277
if (!EnableLoopARC) {
273278
auto *AA = getAnalysis<AliasAnalysis>();
274279
auto *POTA = getAnalysis<PostOrderAnalysis>();

lib/SILOptimizer/FunctionSignatureTransforms/ExistentialSpecializer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ class ExistentialSpecializer : public SILFunctionTransform {
6363
ClassHierarchyAnalysis *CHA;
6464
public:
6565
void run() override {
66-
6766
auto *F = getFunction();
6867

6968
/// Don't optimize functions that should not be optimized.
7069
if (!F->shouldOptimize() || !F->getModule().getOptions().ExistentialSpecializer) {
7170
return;
7271
}
7372

73+
// FIXME: This pass should be able to support ownership.
74+
if (F->hasOwnership())
75+
return;
76+
7477
/// Get CallerAnalysis information handy.
7578
CA = PM->getAnalysis<CallerAnalysis>();
7679

lib/SILOptimizer/IPO/LetPropertiesOpts.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@ void LetPropertiesOpt::run(SILModuleTransform *T) {
581581
// properties.
582582
bool NonRemovable = !F.shouldOptimize();
583583

584+
// FIXME: We should be able to handle ownership.
585+
NonRemovable &= !F.hasOwnership();
586+
584587
for (auto &BB : F) {
585588
for (auto &I : BB)
586589
// Look for any instructions accessing let properties.

lib/SILOptimizer/LoopTransforms/ArrayBoundsCheckOpts.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,9 @@ class ABCOpt : public SILFunctionTransform {
12881288

12891289
SILFunction *F = getFunction();
12901290
assert(F);
1291+
// FIXME: Update for ownership.
1292+
if (F->hasOwnership())
1293+
return;
12911294
SILLoopInfo *LI = LA->get(F);
12921295
assert(LI);
12931296
DominanceInfo *DT = DA->get(F);

lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,10 @@ namespace {
11601160

11611161
class COWArrayOptPass : public SILFunctionTransform {
11621162
void run() override {
1163+
// FIXME: Update for ownership.
1164+
if (getFunction()->hasOwnership())
1165+
return;
1166+
11631167
LLVM_DEBUG(llvm::dbgs() << "COW Array Opts in Func "
11641168
<< getFunction()->getName() << "\n");
11651169

@@ -1847,6 +1851,10 @@ class SwiftArrayOptPass : public SILFunctionTransform {
18471851

18481852
auto *Fn = getFunction();
18491853

1854+
// FIXME: Add support for ownership.
1855+
if (Fn->hasOwnership())
1856+
return;
1857+
18501858
// Don't hoist array property calls at Osize.
18511859
if (Fn->optimizeForSize())
18521860
return;

lib/SILOptimizer/LoopTransforms/LoopRotate.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ class LoopRotation : public SILFunctionTransform {
421421

422422
SILFunction *F = getFunction();
423423
assert(F);
424+
// FIXME: Add ownership support.
425+
if (F->hasOwnership())
426+
return;
427+
424428
SILLoopInfo *LI = LA->get(F);
425429
assert(LI);
426430
DominanceInfo *DT = DA->get(F);

lib/SILOptimizer/Mandatory/GuaranteedARCOpts.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ namespace {
229229
// configuration.
230230
struct GuaranteedARCOpts : SILFunctionTransform {
231231
void run() override {
232+
// Skip ownership SIL. We are going to have a run of semantic arc opts here.
233+
if (getFunction()->hasOwnership())
234+
return;
235+
232236
GuaranteedARCOptsVisitor Visitor;
233237

234238
bool MadeChange = false;

lib/SILOptimizer/SILCombiner/SILCombine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ class SILCombine : public SILFunctionTransform {
345345

346346
/// The entry point to the transformation.
347347
void run() override {
348+
// FIXME: We should be able to handle ownership.
349+
if (getFunction()->hasOwnership())
350+
return;
351+
348352
auto *AA = PM->getAnalysis<AliasAnalysis>();
349353
auto *DA = PM->getAnalysis<DominanceAnalysis>();
350354
auto *PCA = PM->getAnalysis<ProtocolConformanceAnalysis>();

lib/SILOptimizer/Transforms/ARCCodeMotion.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,10 @@ class ARCCodeMotion : public SILFunctionTransform {
11511151
if (!F->shouldOptimize())
11521152
return;
11531153

1154+
// FIXME: Support ownership.
1155+
if (F->hasOwnership())
1156+
return;
1157+
11541158
LLVM_DEBUG(llvm::dbgs() << "*** ARCCM on function: " << F->getName()
11551159
<< " ***\n");
11561160

lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,10 @@ struct AccessEnforcementOpts : public SILFunctionTransform {
11301130
if (F->empty())
11311131
return;
11321132

1133+
// FIXME: Support ownership.
1134+
if (F->hasOwnership())
1135+
return;
1136+
11331137
LLVM_DEBUG(llvm::dbgs() << "Running local AccessEnforcementOpts on "
11341138
<< F->getName() << "\n");
11351139

0 commit comments

Comments
 (0)