Skip to content

Commit

Permalink
Don't generate __restrict__ attribute for ByValue arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 29, 2023
1 parent 189dd70 commit c83e567
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
#[cfg(feature = "master")]
let apply_attrs = |ty: Type<'gcc>, attrs: &ArgAttributes| {
if attrs.regular.contains(rustc_target::abi::call::ArgAttribute::NoAlias)
&& ty.get_pointee().is_some()
{
ty.make_restrict()
} else {
Expand Down Expand Up @@ -151,9 +150,10 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
let ty = cast.gcc_type(cx);
apply_attrs(ty, &cast.attrs)
}
PassMode::Indirect { attrs, extra_attrs: None, on_stack: true } => {
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: true } => {
// This is a "byval" argument, so we don't apply the `restrict` attribute on it.
on_stack_param_indices.insert(argument_tys.len());
apply_attrs(arg.memory_ty(cx), &attrs)
arg.memory_ty(cx)
},
PassMode::Direct(attrs) => apply_attrs(arg.layout.immediate_gcc_type(cx), &attrs),
PassMode::Indirect { attrs, extra_attrs: None, on_stack: false } => {
Expand Down

0 comments on commit c83e567

Please sign in to comment.