[K/N][codegen] Escape analysis: handled nulls more optimally
Helps with https://youtrack.jetbrains.com/issue/KT-44148
This commit is contained in:
+3
-2
@@ -182,13 +182,14 @@ internal object EscapeAnalysis {
|
||||
fun computeDepths(node: DataFlowIR.Node, depth: Int) {
|
||||
if (node is DataFlowIR.Node.Scope)
|
||||
node.nodes.forEach { computeDepths(it, depth + 1) }
|
||||
else
|
||||
else if (node != DataFlowIR.Node.Null)
|
||||
nodesRoles[node] = NodeInfo(depth)
|
||||
}
|
||||
computeDepths(body.rootScope, Depths.ROOT_SCOPE - 1)
|
||||
|
||||
fun assignRole(node: DataFlowIR.Node, role: Role, infoEntry: RoleInfoEntry?) {
|
||||
nodesRoles[node]!!.add(role, infoEntry)
|
||||
if (node != DataFlowIR.Node.Null && infoEntry?.node != DataFlowIR.Node.Null)
|
||||
nodesRoles[node]!!.add(role, infoEntry)
|
||||
}
|
||||
|
||||
body.returns.values.forEach { assignRole(it.node, Role.RETURN_VALUE, null) }
|
||||
|
||||
Reference in New Issue
Block a user