Skip to content

Commit 32a8d75

Browse files
Don't pass NoAlias attribute for arguments passed by value
1 parent 1bd0430 commit 32a8d75

File tree

1 file changed

+10
-0
lines changed
  • compiler/rustc_target/src/abi/call

1 file changed

+10
-0
lines changed

compiler/rustc_target/src/abi/call/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ impl ArgAttributes {
124124
self
125125
}
126126

127+
pub fn unset(&mut self, attr: ArgAttribute) -> &mut Self {
128+
self.regular &= !attr;
129+
self
130+
}
131+
127132
pub fn contains(&self, attr: ArgAttribute) -> bool {
128133
self.regular.contains(attr)
129134
}
@@ -517,6 +522,11 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
517522
match self.mode {
518523
PassMode::Indirect { ref mut attrs, extra_attrs: _, ref mut on_stack } => {
519524
*on_stack = true;
525+
// If the argument is passed by value, the `NoAlias` attribute should never be
526+
// applied. More information about this in:
527+
// * https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171218/512066.html
528+
// * https://reviews.llvm.org/D40118
529+
attrs.unset(ArgAttribute::NoAlias);
520530

521531
// Some platforms, like 32-bit x86, change the alignment of the type when passing
522532
// `byval`. Account for that.

0 commit comments

Comments
 (0)