diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-09-09 07:02:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-09 07:02:30 +0200 |
| commit | 6d2033512b37a7e6f1b659404e471c2352b2f83f (patch) | |
| tree | d2d8198e91f260ced19116f49abe156b930060d6 /compiler/rustc_codegen_llvm/src | |
| parent | 7200da0217f99e929e58d0b40483097db37270ac (diff) | |
| parent | 16525cc4c34649c564e9544ec1d9c45c4c4f4e52 (diff) | |
| download | rust-6d2033512b37a7e6f1b659404e471c2352b2f83f.tar.gz rust-6d2033512b37a7e6f1b659404e471c2352b2f83f.zip | |
Rollup merge of #99207 - 5225225:msan-eager-checks, r=jackh726
Enable eager checks for memory sanitizer Fixes #99179
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/abi.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 0ce161d7e75..26f5225f6b4 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -19,6 +19,7 @@ use rustc_target::abi::call::ArgAbi; pub use rustc_target::abi::call::*; use rustc_target::abi::{self, HasDataLayout, Int}; pub use rustc_target::spec::abi::Abi; +use rustc_target::spec::SanitizerSet; use libc::c_uint; use smallvec::SmallVec; @@ -90,6 +91,13 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&' 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. + + if regular.contains(ArgAttribute::NoUndef) { + attrs.push(llvm::AttributeKind::NoUndef.create_attr(cx.llcx)); + } } attrs |
