Skip to content

Commit 915c5e6

Browse files
authored
Merge pull request #64258 from meg-gupta/disablesilcombinepattern
Disable SILCombine::visitInjectEnumAddrInst for empty tuple types.
2 parents 18b5333 + 89161f9 commit 915c5e6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,16 @@ SILCombiner::visitInjectEnumAddrInst(InjectEnumAddrInst *IEAI) {
13381338
// can't handle the payload case here due to the flow problems caused by the
13391339
// dependency in between the enum and its data.
13401340

1341+
// Disable this for empty typle type because empty tuple stack locations maybe
1342+
// uninitialized. And converting to value form loses tag information.
1343+
if (IEAI->getElement()->hasAssociatedValues()) {
1344+
SILType elemType = IEAI->getOperand()->getType().getEnumElementType(
1345+
IEAI->getElement(), IEAI->getFunction());
1346+
if (elemType.isEmpty(*IEAI->getFunction())) {
1347+
return nullptr;
1348+
}
1349+
}
1350+
13411351
assert(IEAI->getOperand()->getType().isAddress() && "Must be an address");
13421352
Builder.setCurrentDebugScope(IEAI->getDebugScope());
13431353

0 commit comments

Comments
 (0)