VM: Don't rely on always running constant propagation in the optimizer

When inlining functions that unconditionally throw (have zero normal returns),
the optimizer inserts a branch with a true condition and relies on
 constant propagation to remove the rest of the caller which becomes unreachable
 after inlining.

 This allows to compilesuch functions without running constant propagation by
 replacing uses of the return value with null.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1419553005 .
This commit is contained in:
Florian Schneider 2015-10-30 22:48:59 +01:00
parent e9171461fd
commit 05ad578b77

View file

@ -548,6 +548,10 @@ void InlineExitCollector::ReplaceCall(TargetEntryInstr* callee_entry) {
call_->previous()->AppendInstruction(branch);
call_block->set_last_instruction(branch);
// Replace uses of the return value with null to maintain valid
// SSA form - even though the rest of the caller is unreachable.
call_->ReplaceUsesWith(caller_graph_->constant_null());
// Update dominator tree.
call_block->AddDominatedBlock(callee_entry);
call_block->AddDominatedBlock(false_block);