diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-25 12:57:07 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-15 19:41:07 +0200 |
commit | f89f7da999f362e4213c69923328dd1033276e59 (patch) | |
tree | 63f17f52b9d77ffec7c62fe9c5332603d83f007f /llvm/lib/IR/Function.cpp | |
parent | 9de4ee3815db2b49960e931bcc3c0cc6a28ad0de (diff) | |
download | llvm-f89f7da999f362e4213c69923328dd1033276e59.zip llvm-f89f7da999f362e4213c69923328dd1033276e59.tar.gz llvm-f89f7da999f362e4213c69923328dd1033276e59.tar.bz2 |
[IR] Convert null-pointer-is-valid into an enum attribute
The "null-pointer-is-valid" attribute needs to be checked by many
pointer-related combines. To make the check more efficient, convert
it from a string into an enum attribute.
In the future, this attribute may be replaced with data layout
properties.
Differential Revision: https://reviews.llvm.org/D78862
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 7bf3ab5..d8663be 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1641,9 +1641,7 @@ Optional<StringRef> Function::getSectionPrefix() const { } bool Function::nullPointerIsDefined() const { - return getFnAttribute("null-pointer-is-valid") - .getValueAsString() - .equals("true"); + return hasFnAttribute(Attribute::NullPointerIsValid); } bool llvm::NullPointerIsDefined(const Function *F, unsigned AS) { |