diff options
author | Andreas Jonson <andjo403@hotmail.com> | 2024-08-08 18:07:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 18:07:09 +0200 |
commit | 04da77308fcff417d9c925502d92d70761b5054b (patch) | |
tree | b5376816d46b1f241e40b43bf321fdf7adf71d5f /llvm/lib/IR/Attributes.cpp | |
parent | be40c723ce2b7bf2690d22039d74d21b2bd5b7cf (diff) | |
download | llvm-04da77308fcff417d9c925502d92d70761b5054b.zip llvm-04da77308fcff417d9c925502d92d70761b5054b.tar.gz llvm-04da77308fcff417d9c925502d92d70761b5054b.tar.bz2 |
Allow empty range attribute and add assert for full range (#100601)
fix #99619
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 abd05e3..fa124e4 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -171,6 +171,7 @@ Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind, const ConstantRange &CR) { assert(Attribute::isConstantRangeAttrKind(Kind) && "Not a ConstantRange attribute"); + assert(!CR.isFullSet() && "ConstantRange attribute must not be full"); LLVMContextImpl *pImpl = Context.pImpl; FoldingSetNodeID ID; ID.AddInteger(Kind); @@ -2020,6 +2021,9 @@ AttrBuilder &AttrBuilder::addInAllocaAttr(Type *Ty) { AttrBuilder &AttrBuilder::addConstantRangeAttr(Attribute::AttrKind Kind, const ConstantRange &CR) { + if (CR.isFullSet()) + return *this; + return addAttribute(Attribute::get(Ctx, Kind, CR)); } |