cleanup: handle -Zmutable-noalias like -Zbox-noalias
This commit is contained in:
parent
c7572670a1
commit
d165a6d708
4 changed files with 31 additions and 28 deletions
|
@ -34,13 +34,6 @@ pub trait ArgAttributesExt {
|
|||
);
|
||||
}
|
||||
|
||||
fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
|
||||
// LLVM prior to version 12 had known miscompiles in the presence of
|
||||
// noalias attributes (see #54878), but we don't support earlier
|
||||
// versions at all anymore. We now enable mutable noalias by default.
|
||||
cx.tcx.sess.opts.unstable_opts.mutable_noalias.unwrap_or(true)
|
||||
}
|
||||
|
||||
const ABI_AFFECTING_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 1] =
|
||||
[(ArgAttribute::InReg, llvm::AttributeKind::InReg)];
|
||||
|
||||
|
@ -88,9 +81,6 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'
|
|||
attrs.push(llattr.create_attr(cx.llcx));
|
||||
}
|
||||
}
|
||||
if regular.contains(ArgAttribute::NoAliasMutRef) && should_use_mutable_noalias(cx) {
|
||||
attrs.push(llvm::AttributeKind::NoAlias.create_attr(cx.llcx));
|
||||
}
|
||||
} else if cx.tcx.sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::MEMORY) {
|
||||
// If we're not optimising, *but* memory sanitizer is on, emit noundef, since it affects
|
||||
// memory sanitizer's behavior.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue