mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
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:
+2
-2
@@ -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 @@ fn transmute_value<'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);
|
||||
|
||||
Reference in New Issue
Block a user