mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Mem2Reg] Only lifetime canonicalize in OSSA.
Bail both on collecting stores and canonicalizing values if the function being optimized doesn't have ownership.
This commit is contained in:
@@ -2153,6 +2153,8 @@ void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *asi) {
|
||||
void MemoryToRegisters::collectStoredValues(AllocStackInst *asi,
|
||||
StackList<SILValue> &owned,
|
||||
StackList<SILValue> &guaranteed) {
|
||||
if (!f.hasOwnership())
|
||||
return;
|
||||
for (auto *use : asi->getUses()) {
|
||||
auto *user = use->getUser();
|
||||
if (auto *si = dyn_cast<StoreInst>(user)) {
|
||||
@@ -2166,6 +2168,8 @@ void MemoryToRegisters::collectStoredValues(AllocStackInst *asi,
|
||||
void MemoryToRegisters::canonicalizeValueLifetimes(
|
||||
StackList<SILValue> &owned, StackList<SILValue> &guaranteed,
|
||||
BasicBlockSetVector &livePhiBlocks) {
|
||||
if (!f.hasOwnership())
|
||||
return;
|
||||
if (Mem2RegDisableLifetimeCanonicalization)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user