[llvm] [ConstantFold] Support scalable constant splats in ConstantFoldCastInstruction (PR #133207)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 3 05:31:01 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)) &&
----------------
lukel97 wrote:
Looks like it, and it seems like it also causes it to catch ConstantAggregateZeros, I've removed it in 450ead117505fac9cb960efad25ba68489b4f97a
https://github.com/llvm/llvm-project/pull/133207
More information about the llvm-commits
mailing list