[llvm] [LLVM][ConstProp] Enable intrinsic simplifications for vector ConstantInt based operands. (PR #159358)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 06:43:06 PDT 2025


================
@@ -2165,7 +2165,7 @@ Constant *constantFoldVectorReduce(Intrinsic::ID IID, Constant *Op) {
     return PoisonValue::get(VT->getElementType());
 
   // TODO: Handle undef.
-  if (!isa<ConstantVector>(Op) && !isa<ConstantDataVector>(Op))
+  if (!isa<ConstantVector, ConstantDataVector, ConstantInt>(Op))
----------------
paulwalker-arm wrote:

Looking at `getAggregateElement` there is a "bad" path for scalable vectors, but swapping the following `dyn_cast` with `dyn_cast_or_null` should account for that, so yes.

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


More information about the llvm-commits mailing list