Skip to content

Commit 33b8912

Browse files
committed
Allow address-phis with -enforce-exclusivity.
As long as begin/end access scopes are respected, enforce-exclusivity does not actually care about address phis. Eventually, we will disable address phis completely, but that requires adding a "address legalization" transform to various CFG passes, such as jump threading and loop rotate. Meanwhile, we will continue to suppress these CFG transformations when access markers are involved. This means that optimizations will work differently, and some will be suppressed in the presence of access markers. That means that optimizing the access markers themselves will be a prerequisite to enabling them by default, even if the overhead of the checks is tolerable.
1 parent efad1c9 commit 33b8912

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

lib/SIL/SILVerifier.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,15 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
329329
delete Dominance;
330330
}
331331

332-
// Address-type block args must be prohibited whenever access markers are
333-
// present. Access markers are always present in raw SIL to diagnose exclusive
334-
// memory access. In canonical SIL, access markers are only present with
335-
// EnforceExclusivityDynamic.
336-
//
337332
// FIXME: For sanity, address-type block args should be prohibited at all SIL
338333
// stages. However, the optimizer currently breaks the invariant in three
339334
// places:
340335
// 1. Normal Simplify CFG during conditional branch simplification
341336
// (sneaky jump threading).
342337
// 2. Simplify CFG via Jump Threading.
343338
// 3. Loop Rotation.
344-
// Once EnforceExclusivityDynamic is performant enough to be enabled by
345-
// default at -O, address-type blocks args can be prohibited unconditionally.
339+
//
340+
//
346341
bool prohibitAddressBlockArgs() {
347342
// If this function was deserialized from canonical SIL, this invariant may
348343
// already have been violated regardless of this module's SIL stage or
@@ -352,12 +347,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
352347
return false;
353348

354349
SILModule &M = F.getModule();
355-
if (M.getStage() == SILStage::Raw)
356-
return true;
357-
358-
// If dynamic enforcement is enabled, markers are present at -O so we
359-
// prohibit address block args.
360-
return M.getOptions().EnforceExclusivityDynamic;
350+
return M.getStage() == SILStage::Raw;
361351
}
362352

363353
void visitSILArgument(SILArgument *arg) {

0 commit comments

Comments
 (0)