mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Ban address phis in non-OSSA SIL
This commit is contained in:
@@ -985,24 +985,6 @@ public:
|
||||
return InstNumbers[a] < InstNumbers[b];
|
||||
}
|
||||
|
||||
// FIXME: For sanity, address-type phis should be prohibited at all SIL
|
||||
// stages. However, the optimizer currently breaks the invariant in three
|
||||
// places:
|
||||
// 1. Normal Simplify CFG during conditional branch simplification
|
||||
// (sneaky jump threading).
|
||||
// 2. Simplify CFG via Jump Threading.
|
||||
// 3. Loop Rotation.
|
||||
//
|
||||
// BasicBlockCloner::canCloneInstruction and sinkAddressProjections is
|
||||
// designed to avoid this issue, we just need to make sure all passes use it
|
||||
// correctly.
|
||||
//
|
||||
// Minimally, we must prevent address-type phis as long as access markers are
|
||||
// preserved. A goal is to preserve access markers in OSSA.
|
||||
bool prohibitAddressPhis() {
|
||||
return F.hasOwnership();
|
||||
}
|
||||
|
||||
void visitSILPhiArgument(SILPhiArgument *arg) {
|
||||
// Verify that the `isPhiArgument` property is sound:
|
||||
// - Phi arguments come from branches.
|
||||
@@ -1026,7 +1008,7 @@ public:
|
||||
"All phi argument inputs must be from branches.");
|
||||
}
|
||||
}
|
||||
if (arg->isPhi() && prohibitAddressPhis()) {
|
||||
if (arg->isPhi()) {
|
||||
// As a property of well-formed SIL, we disallow address-type
|
||||
// phis. Supporting them would prevent reliably reasoning about the
|
||||
// underlying storage of memory access. This reasoning is important for
|
||||
|
||||
Reference in New Issue
Block a user