Skip to content

Commit 454a445

Browse files
committed
Enable AccessEnforcementOpts with OSSA
1 parent ebf4886 commit 454a445

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

lib/SIL/IR/SILInstruction.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,6 @@ bool SILInstruction::mayRelease() const {
11341134
return true;
11351135

11361136
case SILInstructionKind::DestroyValueInst:
1137-
assert(!SILModuleConventions(getModule()).useLoweredAddresses());
11381137
return true;
11391138

11401139
case SILInstructionKind::UnconditionalCheckedCastAddrInst:

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ void addHighLevelLoopOptPasses(SILPassPipelinePlan &P) {
242242
P.addSimplifyCFG();
243243
// Optimize access markers for better LICM: might merge accesses
244244
// It will also set the no_nested_conflict for dynamic accesses
245+
// AccessEnforcementReleaseSinking results in non-canonical OSSA.
246+
// It is only used to expose opportunities in AccessEnforcementOpts
247+
// before CanonicalOSSA re-hoists destroys.
245248
P.addAccessEnforcementReleaseSinking();
246249
P.addAccessEnforcementOpts();
247250
P.addHighLevelLICM();
@@ -250,6 +253,9 @@ void addHighLevelLoopOptPasses(SILPassPipelinePlan &P) {
250253
// LICM might have added new merging potential by hoisting
251254
// we don't want to restart the pipeline - ignore the
252255
// potential of merging out of two loops
256+
// AccessEnforcementReleaseSinking results in non-canonical OSSA.
257+
// It is only used to expose opportunities in AccessEnforcementOpts
258+
// before CanonicalOSSA re-hoists destroys.
253259
P.addAccessEnforcementReleaseSinking();
254260
P.addAccessEnforcementOpts();
255261
// Start of loop unrolling passes.

lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
/// - Should run immediately before the AccessEnforcementWMO to share
1818
/// AccessedStorageAnalysis results.
1919
///
20+
/// - Benefits from running after AccessEnforcementReleaseSinking.
21+
///
2022
/// This pass optimizes access enforcement as follows:
2123
///
2224
/// **Access marker folding**
@@ -727,7 +729,7 @@ void AccessConflictAndMergeAnalysis::visitFullApply(FullApplySite fullApply,
727729
ASA->getCallSiteEffects(callSiteAccesses, fullApply);
728730

729731
LLVM_DEBUG(llvm::dbgs() << "Visiting: " << *fullApply.getInstruction()
730-
<< " call site accesses: ";
732+
<< " call site accesses:\n";
731733
callSiteAccesses.dump());
732734
recordConflicts(state, callSiteAccesses.getResult());
733735
}
@@ -1094,10 +1096,6 @@ struct AccessEnforcementOpts : public SILFunctionTransform {
10941096
if (F->empty())
10951097
return;
10961098

1097-
// FIXME: Support ownership.
1098-
if (F->hasOwnership())
1099-
return;
1100-
11011099
LLVM_DEBUG(llvm::dbgs() << "Running local AccessEnforcementOpts on "
11021100
<< F->getName() << "\n");
11031101

0 commit comments

Comments
 (0)