Native: remove cleanup landingpad if it is unused

Useful for ObjCExport, because most of its bridges don't use it.
This commit is contained in:
Svyatoslav Scherbina
2022-01-13 16:18:55 +03:00
committed by Space
parent 47a0bdc1bc
commit ec3a2c9671
@@ -1510,7 +1510,10 @@ internal abstract class FunctionGenerationContext(
processReturns()
if (!needCleanupLandingpadAndLeaveFrame) {
// If cleanup landingpad is trivial or unused, remove it.
// It would be great not to generate it in the first place in this case,
// but this would be complicated without a major refactoring.
if (!needCleanupLandingpadAndLeaveFrame || invokeInstructions.isEmpty()) {
// Replace invokes with calls and branches.
invokeInstructions.forEach { functionInvokeInfo ->
positionBefore(functionInvokeInfo.invokeInstruction)