Don't force many scalar pair values to the stack in write_cvalue_maybe_transmute
Sometimes it is necessary for handling vector to scalar pair transmutes, but if the types are the same there is no need for this. This improves runtime performance on simple-raytracer by 12%.
This commit is contained in:
parent
79f4cc0822
commit
df04fd6fba
@ -98,12 +98,12 @@ pub(super) fn add_local_place_comments<'tcx>(
|
||||
}
|
||||
CPlaceInner::VarPair(place_local, var1, var2) => {
|
||||
assert_eq!(local, place_local);
|
||||
("ssa", Cow::Owned(format!(",var=({}, {})", var1.index(), var2.index())))
|
||||
("ssa", Cow::Owned(format!("var=({}, {})", var1.index(), var2.index())))
|
||||
}
|
||||
CPlaceInner::VarLane(_local, _var, _lane) => unreachable!(),
|
||||
CPlaceInner::Addr(ptr, meta) => {
|
||||
let meta = if let Some(meta) = meta {
|
||||
Cow::Owned(format!(",meta={}", meta))
|
||||
Cow::Owned(format!("meta={}", meta))
|
||||
} else {
|
||||
Cow::Borrowed("")
|
||||
};
|
||||
|
@ -588,10 +588,13 @@ impl<'tcx> CPlace<'tcx> {
|
||||
return;
|
||||
}
|
||||
CPlaceInner::VarPair(_local, var1, var2) => {
|
||||
let (ptr, meta) = from.force_stack(fx);
|
||||
assert!(meta.is_none());
|
||||
let (data1, data2) =
|
||||
CValue(CValueInner::ByRef(ptr, None), dst_layout).load_scalar_pair(fx);
|
||||
let (data1, data2) = if self.layout().ty == dst_layout.ty {
|
||||
CValue(from.0, dst_layout).load_scalar_pair(fx)
|
||||
} else {
|
||||
let (ptr, meta) = from.force_stack(fx);
|
||||
assert!(meta.is_none());
|
||||
CValue(CValueInner::ByRef(ptr, None), dst_layout).load_scalar_pair(fx)
|
||||
};
|
||||
let (dst_ty1, dst_ty2) = fx.clif_pair_type(self.layout().ty).unwrap();
|
||||
transmute_value(fx, var1, data1, dst_ty1);
|
||||
transmute_value(fx, var2, data2, dst_ty2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user