Skip to content

LargeTypesReg2Mem: Handle the optional projections with larger payloads #71517

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/IRGen/LoadableByAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4266,8 +4266,11 @@ static void runPeepholesAndReg2Mem(SILPassManager *pm, SILModule *silMod,
// switch_enum.
if (auto *pred = bb.getSinglePredecessorBlock()) {
// switch_enum handles the basic block arguments independently.
if (isa<SwitchEnumInst>(pred->getTerminator()))
continue;
if (auto sw = dyn_cast<SwitchEnumInst>(pred->getTerminator())) {
if (assignment.isLargeLoadableType(sw->getOperand()->getType())) {
continue;
}
}
}

// Handle all other basic block arguments.
Expand All @@ -4282,7 +4285,8 @@ static void runPeepholesAndReg2Mem(SILPassManager *pm, SILModule *silMod,
// Large try apply results have to be stored to their stack location
// in the success block.
if (auto *pred = bb.getSinglePredecessorBlock()) {
if (auto *term = dyn_cast<TryApplyInst>(pred->getTerminator())) {
if (isa<TryApplyInst>(pred->getTerminator()) ||
isa<SwitchEnumInst>(pred->getTerminator())) {
assert(bb.getArguments().size() == 1);
shouldDeleteBlockArgument = false;
// We will emit the store to initialize after parsing all other
Expand Down