Combine sort keys into u64/u128
This allows the compiler to perform branch-less comparisons, which are more efficient. This results in ~5% fewer instructions executed.
This commit is contained in:
@@ -18,7 +18,7 @@ use super::{
|
||||
SpillSetIndex, Use, VRegData, VRegIndex, SLOT_NONE,
|
||||
};
|
||||
use crate::indexset::IndexSet;
|
||||
use crate::ion::data_structures::MultiFixedRegFixup;
|
||||
use crate::ion::data_structures::{u128_key, MultiFixedRegFixup};
|
||||
use crate::{
|
||||
Allocation, Block, Function, Inst, InstPosition, Operand, OperandConstraint, OperandKind,
|
||||
OperandPos, PReg, ProgPoint, RegAllocError, VReg,
|
||||
@@ -1141,8 +1141,24 @@ impl<'a, F: Function> Env<'a, F> {
|
||||
}
|
||||
}
|
||||
|
||||
self.blockparam_ins.sort_unstable();
|
||||
self.blockparam_outs.sort_unstable();
|
||||
self.blockparam_ins
|
||||
.sort_unstable_by_key(|(to_vreg, to_block, from_block)| {
|
||||
u128_key(
|
||||
to_vreg.raw_u32(),
|
||||
to_block.raw_u32(),
|
||||
from_block.raw_u32(),
|
||||
0,
|
||||
)
|
||||
});
|
||||
self.blockparam_outs
|
||||
.sort_unstable_by_key(|(from_vreg, from_block, to_block, to_vreg)| {
|
||||
u128_key(
|
||||
from_vreg.raw_u32(),
|
||||
from_block.raw_u32(),
|
||||
to_block.raw_u32(),
|
||||
to_vreg.raw_u32(),
|
||||
)
|
||||
});
|
||||
self.prog_move_srcs.sort_unstable_by_key(|(pos, _)| *pos);
|
||||
self.prog_move_dsts.sort_unstable_by_key(|(pos, _)| *pos);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user