[llvm] Allow empty range attribute and add assert for full range (PR #100601)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 06:00:07 PDT 2024


================
@@ -286,6 +286,12 @@ Attribute Attribute::getWithNoFPClass(LLVMContext &Context,
   return get(Context, NoFPClass, ClassMask);
 }
 
+Attribute Attribute::getWithRange(LLVMContext &Context,
+                                  const ConstantRange &CR) {
+  assert(!CR.isFullSet() && "Range must not be full!");
----------------
nikic wrote:

I think it would be okay to just add this directly into the generic ctor, rather than specific to `range`. I would expect that other range-based attributes added in the future will not allow full ranges either. (If they do, we can separate it out at the time.)

https://github.com/llvm/llvm-project/pull/100601


More information about the llvm-commits mailing list