Commit 36f00920 authored by qinsoon's avatar qinsoon

fix peephole opt

for movl %edi %edi (where two operands are actually %edi %rdi), we will
do a check, and ensure it get removed
parent fdec1e4f
......@@ -2,6 +2,7 @@ use compiler::CompilerPass;
use ast::ir::*;
use vm::VM;
use compiler::machine_code::CompiledFunction;
use compiler::backend;
use std::any::Any;
......@@ -43,10 +44,13 @@ impl PeepholeOptimization {
}
};
if src_machine_reg == dst_machine_reg {
if backend::get_color_for_precolroed(src_machine_reg)
== backend::get_color_for_precolroed(dst_machine_reg) {
trace!("Redundant! removed");
// redundant, remove this move
cf.mc_mut().set_inst_nop(inst);
} else {
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment