diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-25 18:04:50 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-25 18:07:31 +0200 |
commit | 99f869c8f00a36dac3c774178b69d05876a29a31 (patch) | |
tree | f24831ba29855774bbb778aacb6ec812d3c32c14 /llvm/lib/IR/Attributes.cpp | |
parent | 34dc4f24f2d38b18cccbc2dc0aaa7cb44cd54313 (diff) | |
download | llvm-99f869c8f00a36dac3c774178b69d05876a29a31.zip llvm-99f869c8f00a36dac3c774178b69d05876a29a31.tar.gz llvm-99f869c8f00a36dac3c774178b69d05876a29a31.tar.bz2 |
[Attributes] Remove nonnull from UB-implying attributes
From LangRef:
> if the parameter or return pointer is null, poison value is
> returned or passed instead. The nonnull attribute should be
> combined with the noundef attribute to ensure a pointer is not
> null or otherwise the behavior is undefined.
Dropping noundef is sufficient to prevent UB. Including nonnull
in this method just muddies the semantics.
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index fc05f52..92721c7 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1340,7 +1340,6 @@ AttributeList::removeParamUndefImplyingAttributes(LLVMContext &C, unsigned ArgNo) const { AttrBuilder B; B.addAttribute(Attribute::NoUndef); - B.addAttribute(Attribute::NonNull); B.addDereferenceableAttr(1); B.addDereferenceableOrNullAttr(1); return removeParamAttributes(C, ArgNo, B); |