EagerSpecializer: fix a SIL verifier crash

When inserting type checks for pre-specialized functions, the existing return-block can only be re-used if it has no arguments.
Otherwise we are creating an argument-less branch to a block with arguments.

rdar://124638266
This commit is contained in:
Erik Eckstein
2024-03-19 12:28:33 +01:00
parent 81812eaf2a
commit a5320a6fcd
2 changed files with 20 additions and 0 deletions

View File

@@ -72,6 +72,9 @@ static bool isTrivialReturnBlock(SILBasicBlock *RetBB) {
// % = tuple ()
// return % : $()
if (RetOperand->getType().isVoid()) {
if (!RetBB->args_empty())
return false;
auto *TupleI = dyn_cast<TupleInst>(RetBB->begin());
if (!TupleI || !TupleI->getType().isVoid())
return false;