Skip to content

Commit d4f727a

Browse files
committed
[region-isolation] Add support for identifying names when a temporary is initialized with a store.
1 parent f87dbb5 commit d4f727a

File tree

5 files changed

+162
-88
lines changed

5 files changed

+162
-88
lines changed

lib/SILOptimizer/Utils/VariableNameUtils.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ SILValue VariableNameInferrer::getRootValueForTemporaryAllocation(
5757
}
5858
}
5959

60+
if (auto *si = dyn_cast<StoreInst>(&inst)) {
61+
if (si->getDest() == allocInst &&
62+
si->getOwnershipQualifier() != StoreOwnershipQualifier::Assign) {
63+
return si->getSrc();
64+
}
65+
}
66+
6067
// If we do not identify the write... return SILValue(). We weren't able to
6168
// understand the write.
6269
return SILValue();

0 commit comments

Comments
 (0)