Traverse store-load chains for POP instructions

POP instructions can be only live usages for functional parameters,
e.g., when corresponding invoke is in dead code (KT-17591).
This commit is contained in:
Dmitry Petrov
2017-04-25 18:07:57 +03:00
parent fe571a7dfa
commit a39a0abb2a
6 changed files with 70 additions and 2 deletions
@@ -516,8 +516,11 @@ public class MethodInliner {
}
}
else if (cur.getOpcode() == Opcodes.POP) {
LambdaInfo lambda = getLambdaIfExists(MethodInlinerUtilKt.singleOrNullInsn(StackTransformationUtilsKt.top(frame)));
if (lambda != null) {
SourceValue top = StackTransformationUtilsKt.top(frame);
LambdaInfo lambdaInfo = MethodInlinerUtilKt.getLambdaIfExistsAndMarkInstructions(
this, top, true, instructions, sources, toDelete
);
if (lambdaInfo != null) {
toDelete.add(cur);
}
}