[llvm] [Verifier] Add checks for range attribute on ImmArg (PR #140522)

Durgadoss R via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 12:13:08 PDT 2025


================
@@ -3680,6 +3684,20 @@ void Verifier::visitCallBase(CallBase &Call) {
       Value *ArgVal = Call.getArgOperand(i);
       Check(isa<ConstantInt>(ArgVal) || isa<ConstantFP>(ArgVal),
             "immarg operand has non-immediate parameter", ArgVal, Call);
+
+      // If the imm-arg is an integer and also has a range attached,
+      // check if the given value is within the range.
+      if (Call.paramHasAttr(i, Attribute::Range)) {
+        if (auto CI = dyn_cast<ConstantInt>(ArgVal)) {
----------------
durga4github wrote:

Sure, fixed it in the latest revision

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


More information about the llvm-commits mailing list