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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 01:36:43 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);
----------------
nikic wrote:

I don't want to use computeConstantRange() here, but extracting a common helper would make sense as a followup, as part of making computeConstantRange() handle poison elements.

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


More information about the llvm-commits mailing list