[llvm] [ConstantFold] Support scalable constant splats in ConstantFoldCastInstruction (PR #133207)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 2 23:18:07 PDT 2025
================
@@ -160,10 +160,10 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
// If the cast operand is a constant vector, perform the cast by
// operating on each element. In the cast of bitcasts, the element
// count may be mismatched; don't attempt to handle that here.
- if ((isa<ConstantVector>(V) || isa<ConstantDataVector>(V)) &&
- DestTy->isVectorTy() &&
- cast<FixedVectorType>(DestTy)->getNumElements() ==
- cast<FixedVectorType>(V->getType())->getNumElements()) {
+ if ((isa<ConstantVector, ConstantDataVector, ConstantExpr>(V)) &&
----------------
nikic wrote:
Can we drop this check entirely?
https://github.com/llvm/llvm-project/pull/133207
More information about the llvm-commits
mailing list