[interp] Retry cprop pass if killing stloc (mono/mono#17491)
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 23 Oct 2019 07:39:27 +0000 (10:39 +0300)
committerGitHub <noreply@github.com>
Wed, 23 Oct 2019 07:39:27 +0000 (10:39 +0300)
When replacing a stloc with a pop, we should retry the pass, since it is very likely that we will be able to kill the instruction that pushed that value on the stack.

Commit migrated from https://github.com/mono/mono/commit/4419dc919f01c6d97ecd1662929adc6e7e642e83

src/mono/mono/mini/interp/transform.c

index be56f84..48f18c9 100644 (file)
@@ -6540,6 +6540,8 @@ interp_local_deadce (TransformData *td, int *local_ref_count)
                                // We store to a dead stloc, we can replace it with a POP to save local space
                                ins->opcode = MINT_POP;
                                mono_interp_stats.added_pop_count++;
+                               // We might to be able to kill both the pop and the instruction pushing the value
+                               needs_cprop = TRUE;
                        }
                }
        }