1
Fork 0

Remove StructRet arg attr

It is applied exactly when the return value has an indirect pass mode.
Except for InReg on x86 fastcall, arg attrs are now only used for
optimization purposes and thus are fine to ignore.
This commit is contained in:
bjorn3 2020-11-14 19:16:43 +01:00
parent 42b0b8080d
commit 39b8b2b623
3 changed files with 6 additions and 12 deletions

View file

@ -36,7 +36,7 @@ impl ArgAttributeExt for ArgAttribute {
where where
F: FnMut(llvm::Attribute), F: FnMut(llvm::Attribute),
{ {
for_each_kind!(self, f, NoAlias, NoCapture, NonNull, ReadOnly, StructRet, InReg) for_each_kind!(self, f, NoAlias, NoCapture, NonNull, ReadOnly, InReg)
} }
} }
@ -429,7 +429,8 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
} }
PassMode::Indirect { ref attrs, extra_attrs: _, on_stack } => { PassMode::Indirect { ref attrs, extra_attrs: _, on_stack } => {
assert!(!on_stack); assert!(!on_stack);
apply(attrs); let i = apply(attrs);
llvm::Attribute::StructRet.apply_llfn(llvm::AttributePlace::Argument(i), llfn);
} }
_ => {} _ => {}
} }
@ -484,7 +485,9 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
} }
PassMode::Indirect { ref attrs, extra_attrs: _, on_stack } => { PassMode::Indirect { ref attrs, extra_attrs: _, on_stack } => {
assert!(!on_stack); assert!(!on_stack);
apply(attrs); let i = apply(attrs);
llvm::Attribute::StructRet
.apply_callsite(llvm::AttributePlace::Argument(i), callsite);
} }
_ => {} _ => {}
} }

View file

@ -2801,10 +2801,6 @@ where
for arg in &mut self.args { for arg in &mut self.args {
fixup(arg, false); fixup(arg, false);
} }
if let PassMode::Indirect { ref mut attrs, extra_attrs: _, on_stack: _ } = self.ret.mode
{
attrs.set(ArgAttribute::StructRet);
}
return; return;
} }

View file

@ -59,7 +59,6 @@ mod attr_impl {
const NoCapture = 1 << 2; const NoCapture = 1 << 2;
const NonNull = 1 << 3; const NonNull = 1 << 3;
const ReadOnly = 1 << 4; const ReadOnly = 1 << 4;
const StructRet = 1 << 6;
const InReg = 1 << 8; const InReg = 1 << 8;
} }
} }
@ -619,10 +618,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
a => return Err(format!("unrecognized arch \"{}\" in target specification", a)), a => return Err(format!("unrecognized arch \"{}\" in target specification", a)),
} }
if let PassMode::Indirect { ref mut attrs, extra_attrs: _, on_stack: _ } = self.ret.mode {
attrs.set(ArgAttribute::StructRet);
}
Ok(()) Ok(())
} }
} }