diff options
author | Haopeng Liu <153236845+haopliu@users.noreply.github.com> | 2024-06-21 12:09:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-21 12:09:00 -0700 |
commit | 5ece35df8586d0cb8c104a9f44eaae771de025f5 (patch) | |
tree | b1c14e2f040a5282bb7f3a3a2ea73927df22e2cb /llvm/lib/IR/Verifier.cpp | |
parent | f1f3c34b4770437bdb022737918603b4bbeb523e (diff) | |
download | llvm-5ece35df8586d0cb8c104a9f44eaae771de025f5.zip llvm-5ece35df8586d0cb8c104a9f44eaae771de025f5.tar.gz llvm-5ece35df8586d0cb8c104a9f44eaae771de025f5.tar.bz2 |
Add the 'initializes' attribute langref and support (#84803)
We propose adding a new LLVM attribute,
`initializes((Lo1,Hi1),(Lo2,Hi2),...)`, which expresses the notion of
memory space (i.e., intervals, in bytes) that the argument pointing to
is initialized in the function.
Will commit the attribute inferring in the follow-up PRs.
https://discourse.llvm.org/t/rfc-llvm-new-initialized-parameter-attribute-for-improved-interprocedural-dse/77337
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index fe2253d..0abd5f7 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -72,6 +72,7 @@ #include "llvm/IR/Comdat.h" #include "llvm/IR/Constant.h" #include "llvm/IR/ConstantRange.h" +#include "llvm/IR/ConstantRangeList.h" #include "llvm/IR/Constants.h" #include "llvm/IR/ConvergenceVerifier.h" #include "llvm/IR/DataLayout.h" @@ -2059,6 +2060,14 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty, } } + if (Attrs.hasAttribute(Attribute::Initializes)) { + auto Inits = Attrs.getAttribute(Attribute::Initializes).getInitializes(); + Check(!Inits.empty(), "Attribute 'initializes' does not support empty list", + V); + Check(ConstantRangeList::isOrderedRanges(Inits), + "Attribute 'initializes' does not support unordered ranges", V); + } + if (Attrs.hasAttribute(Attribute::NoFPClass)) { uint64_t Val = Attrs.getAttribute(Attribute::NoFPClass).getValueAsInt(); Check(Val != 0, "Attribute 'nofpclass' must have at least one test bit set", |