-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Enable mem2reg of enum types #65085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable mem2reg of enum types #65085
Conversation
if (asi->getType().isOrHasEnum()) { | ||
for (auto it : initializationPoints) { | ||
auto *si = it.second; | ||
auto src = si->getOperand(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should [a function extracted from--no need to find the block, only to find the appropriate value to use] StackAllocationPromoter::getLiveOutValues(_, it.first)
be used here to find the lexical borrows or moves that may have been introduced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lifetime completion will work on the inner borrows. But looks like it doesn't for inner moves (or any other forwarding consumes). Also lifetime completion of lexical values (move_value [lexical]) is only possible at the unreachable blocks, what we really need is lifetime completion at the boundary in this case in mem2reg. Looks like some additional work is needed here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to wait for @atrick's comment here about the lifetime completion utility's use in this case.
@nate-chandler Until then, I have disabled this for lexical stack locs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@meg-gupta @nate-chandler For the record...
Lifetime completion only handles inner scopes that might affect the lifetime of the outer scope. It doesn't make sense for lifetime completion to look past any consumes.
This will, however, change when we fully support a mark_dependence
where an owned value depends on a borrow scope. To handle that, we'll need to look through all potentially forwarding consumes. The final destroy will need to be within the borrow scope. That change only affects cases where such a mark_dependence exists
f7b443f
to
70069f9
Compare
@swift-ci test |
Needs #65074 to be merged |
@swift-ci test |
@swift-ci please benchmark |
@swift-ci Please Apple Silicon benchmark |
Previously it was disabled because we have incomplete address lifetimes for such types, and transforming to value form in mem2reg would expose verification errors due to incompleteness. Enable this case here and fixup the lifetimes using the new lifetime completion utility.
70069f9
to
96a6d44
Compare
@swift-ci smoke test and merge |
I think that this might be causing problems on the Windows builds:
|
CC: @MaxDesiatov |
@swift-ci please build toolchain Windows platform |
Previously it was disabled because we have incomplete address lifetimes for such types,
and transforming to value form in mem2reg would expose verification errors due to incompleteness.
Enable this case here and fixup the lifetimes using the new lifetime completion utility.