Skip to content

Commit c83e567

Browse files
Don't generate __restrict__ attribute for ByValue arguments
1 parent 189dd70 commit c83e567

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/abi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
123123
#[cfg(feature = "master")]
124124
let apply_attrs = |ty: Type<'gcc>, attrs: &ArgAttributes| {
125125
if attrs.regular.contains(rustc_target::abi::call::ArgAttribute::NoAlias)
126-
&& ty.get_pointee().is_some()
127126
{
128127
ty.make_restrict()
129128
} else {
@@ -151,9 +150,10 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
151150
let ty = cast.gcc_type(cx);
152151
apply_attrs(ty, &cast.attrs)
153152
}
154-
PassMode::Indirect { attrs, extra_attrs: None, on_stack: true } => {
153+
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: true } => {
154+
// This is a "byval" argument, so we don't apply the `restrict` attribute on it.
155155
on_stack_param_indices.insert(argument_tys.len());
156-
apply_attrs(arg.memory_ty(cx), &attrs)
156+
arg.memory_ty(cx)
157157
},
158158
PassMode::Direct(attrs) => apply_attrs(arg.layout.immediate_gcc_type(cx), &attrs),
159159
PassMode::Indirect { attrs, extra_attrs: None, on_stack: false } => {

0 commit comments

Comments
 (0)