[llvm] [CVP][LVI] Add support for vectors (PR #97428)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 08:52:54 PDT 2024


================
@@ -844,6 +862,9 @@ static ConstantRange toConstantRange(const ValueLatticeElement &Val,
   unsigned BW = Ty->getScalarSizeInBits();
   if (Val.isUnknown())
     return ConstantRange::getEmpty(BW);
+  if (Val.isConstant())
+    if (auto *VTy = dyn_cast<FixedVectorType>(Ty))
+      return getConstantRangeFromVector(Val.getConstant(), VTy);
----------------
dtcxzyw wrote:

```suggestion
  if (Val.isConstant()) {
      if (auto *CI = dyn_cast_or_null<ConstantInt>(Val.getConstant()->getSplatValue(/*AllowPoison=*/true)))
          return ConstantRange(CI->getValue());
    if (auto *VTy = dyn_cast<FixedVectorType>(Ty))
      return getConstantRangeFromVector(Val.getConstant(), VTy);
  }
```
Do you have plan to support constant scalable vector splats?


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


More information about the llvm-commits mailing list