1
Fork 0

Auto merge of #93670 - erikdesjardins:noundef, r=nikic

Apply noundef attribute to &T, &mut T, Box<T>, bool

This doesn't handle `char` because it's a bit awkward to distinguish it from `u32` at this point in codegen.

Note that this _does not_ change whether or not it is UB for `&`, `&mut`, or `Box` to point to undef. It only applies to the pointer itself, not the pointed-to memory.

Fixes (partially) #74378.

r? `@nikic` cc `@RalfJung`
This commit is contained in:
bors 2022-02-13 00:14:52 +00:00
commit 5c30d65683
13 changed files with 94 additions and 91 deletions

View file

@ -37,7 +37,7 @@ impl ArgAttributeExt for ArgAttribute {
where
F: FnMut(llvm::Attribute),
{
for_each_kind!(self, f, NoAlias, NoCapture, NonNull, ReadOnly, InReg)
for_each_kind!(self, f, NoAlias, NoCapture, NonNull, ReadOnly, InReg, NoUndef)
}
}

View file

@ -189,6 +189,7 @@ pub enum Attribute {
StackProtectReq = 30,
StackProtectStrong = 31,
StackProtect = 32,
NoUndef = 33,
}
/// LLVMIntPredicate