backend: add workaround for phi nodes with zero entries
This commit is contained in:
committed by
SvyatoslavScherbina
parent
7797b0efdc
commit
dfa07836fd
+6
-6
@@ -767,12 +767,12 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
|
|||||||
private fun evaluateExpressionAndJump(expression: IrExpression, destination: ContinuationBlock) {
|
private fun evaluateExpressionAndJump(expression: IrExpression, destination: ContinuationBlock) {
|
||||||
val result = evaluateExpression(expression)
|
val result = evaluateExpression(expression)
|
||||||
|
|
||||||
if (!codegen.isAfterTerminator()) {
|
// It is possible to check here whether the generated code has the normal continuation path
|
||||||
jump(destination, result)
|
// and do not generate any jump if not;
|
||||||
} else {
|
// however such optimization can lead to phi functions with zero entries, which is not allowed by LLVM;
|
||||||
// Workaround for unreachable code handling.
|
// TODO: find the better solution.
|
||||||
// Note: cannot rely on checking that expression type is Nothing.
|
|
||||||
}
|
jump(destination, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------//
|
//-------------------------------------------------------------------------//
|
||||||
|
|||||||
Reference in New Issue
Block a user