Avoid generating value split instructions.

The legalizer often splits values into parts with the vsplit and
isplit_lohi instructions. Avoid doing that for values that are already
defined by the corresponding concatenation instructions.

This reduces the number of instructions created during legalization, and
it simplifies later optimizations. A number of dead concatenation
instructions are left behind. They can be trivially cleaned up by a dead
code elimination pass.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-21 13:25:08 -07:00
parent a44a4d2718
commit 22334bcb54
5 changed files with 181 additions and 35 deletions

View File

@@ -22,6 +22,7 @@ use ir::{Function, Cursor, DataFlowGraph, Inst, InstBuilder, Ebb, Type, Value, S
ArgumentType};
use ir::instructions::CallInfo;
use isa::TargetIsa;
use legalizer::split::{isplit, vsplit};
/// Legalize all the function signatures in `func`.
///
@@ -271,12 +272,12 @@ fn convert_to_abi<PutArg>(dfg: &mut DataFlowGraph,
let ty = dfg.value_type(value);
match legalize_abi_value(ty, &arg_type) {
ValueConversion::IntSplit => {
let (lo, hi) = dfg.ins(pos).isplit(value);
let (lo, hi) = isplit(dfg, pos, value);
convert_to_abi(dfg, pos, lo, put_arg);
convert_to_abi(dfg, pos, hi, put_arg);
}
ValueConversion::VectorSplit => {
let (lo, hi) = dfg.ins(pos).vsplit(value);
let (lo, hi) = vsplit(dfg, pos, value);
convert_to_abi(dfg, pos, lo, put_arg);
convert_to_abi(dfg, pos, hi, put_arg);
}