diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-05-20 01:23:40 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-05-20 01:23:40 +0000 |
commit | d52b1528c0dd7a5f00e18d9ba974c8ef0e549f0b (patch) | |
tree | c00b5abebd9a613232f62650ef6c5cfd5a857e96 /llvm/lib/IR/Attributes.cpp | |
parent | 57cccec4467282be31fb1c8b47bd1a71629ff732 (diff) | |
download | bcm5719-llvm-d52b1528c0dd7a5f00e18d9ba974c8ef0e549f0b.tar.gz bcm5719-llvm-d52b1528c0dd7a5f00e18d9ba974c8ef0e549f0b.zip |
Add 'nonnull', a new parameter and return attribute which indicates that the pointer is not null. Instcombine will elide comparisons between these and null. Patch by Luqman Aden!
llvm-svn: 209185
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 0bbbd559780..a9074bb294d 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -193,6 +193,8 @@ std::string Attribute::getAsString(bool InAttrGrp) const { return "noinline"; if (hasAttribute(Attribute::NonLazyBind)) return "nonlazybind"; + if (hasAttribute(Attribute::NonNull)) + return "nonnull"; if (hasAttribute(Attribute::NoRedZone)) return "noredzone"; if (hasAttribute(Attribute::NoReturn)) @@ -392,6 +394,7 @@ uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) { case Attribute::Builtin: return 1ULL << 41; case Attribute::OptimizeNone: return 1ULL << 42; case Attribute::InAlloca: return 1ULL << 43; + case Attribute::NonNull: return 1ULL << 44; } llvm_unreachable("Unsupported attribute type"); } @@ -1177,6 +1180,7 @@ AttributeSet AttributeFuncs::typeIncompatible(Type *Ty, uint64_t Index) { .addAttribute(Attribute::Nest) .addAttribute(Attribute::NoAlias) .addAttribute(Attribute::NoCapture) + .addAttribute(Attribute::NonNull) .addAttribute(Attribute::ReadNone) .addAttribute(Attribute::ReadOnly) .addAttribute(Attribute::StructRet) |