Skip to content

Commit 03b6c52

Browse files
committed
[CanOSSALifetime] Respect lexical lifetimes flag.
Don't respect deinit barriers when canonicalizing if lexical lifetimes are disabled.
1 parent 5888ed7 commit 03b6c52

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/swift/SILOptimizer/Utils/CanonicalizeOSSALifetime.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@ class CanonicalizeOSSALifetime final {
396396
UserRange getUsers() const { return liveness->getAllUsers(); }
397397

398398
private:
399+
bool respectsDeinitBarriers() const {
400+
if (!currentDef->isLexical())
401+
return false;
402+
auto &module = currentDef->getFunction()->getModule();
403+
return module.getASTContext().SILOpts.supportsLexicalLifetimes(module);
404+
}
405+
399406
void recordDebugValue(DebugValueInst *dvi) { debugValues.insert(dvi); }
400407

401408
void recordConsumingUse(Operand *use) {

lib/SILOptimizer/Utils/CanonicalizeOSSALifetime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ bool CanonicalizeOSSALifetime::computeLiveness() {
11241124
clear();
11251125
return false;
11261126
}
1127-
if (currentDef->isLexical()) {
1127+
if (respectsDeinitBarriers()) {
11281128
extendLivenessToDeinitBarriers();
11291129
}
11301130
if (accessBlockAnalysis) {

0 commit comments

Comments
 (0)