Skip to content

Commit a4fc004

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

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
@@ -1125,7 +1125,7 @@ bool CanonicalizeOSSALifetime::computeLiveness() {
11251125
clear();
11261126
return false;
11271127
}
1128-
if (currentDef->isLexical()) {
1128+
if (respectsDeinitBarriers()) {
11291129
extendLivenessToDeinitBarriers();
11301130
}
11311131
if (accessBlockAnalysis) {

0 commit comments

Comments
 (0)