================
@@ -1011,6 +1011,31 @@ static Value *foldPHINodeOrSelectInst(Instruction &I) {
   return foldSelectInst(cast<SelectInst>(I));
 }
 
+/// Returns a fixed vector type equivalent to the memory set by II or nullptr 
if
+/// unable to do so.
+static FixedVectorType *getVectorTypeFor(const MemSetInst &II,
+                                         const DataLayout &DL) {
+  const ConstantInt *Length = dyn_cast<ConstantInt>(II.getLength());
+  if (!Length)
+    return nullptr;
+
+  APInt Val = Length->getValue();
+  if (Val.ugt(std::numeric_limits<unsigned>::max()))
+    return nullptr;
----------------
macurtis-amd wrote:

>Is this just because the maximum number of vector elts?

Yes.

> Although we probably shouldn't be trying to promote anything that's anything 
> close to that big.

Is there a better limit that I should use instead?

I see other similar checks 
[here](https://github.com/llvm/llvm-project/blob/f4d25c498a20d73b9d3e4828023486a7b2591f38/llvm/lib/Transforms/Scalar/SROA.cpp#L2219)
 and 
[here](https://github.com/llvm/llvm-project/blob/f4d25c498a20d73b9d3e4828023486a7b2591f38/llvm/lib/Transforms/Scalar/SROA.cpp#L3196).

https://github.com/llvm/llvm-project/pull/133301
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to