diff options
author | Eli Friedman <efriedma@quicinc.com> | 2019-12-06 12:33:46 -0800 |
---|---|---|
committer | Eli Friedman <efriedma@quicinc.com> | 2019-12-09 15:31:50 -0800 |
commit | 7c69a03c56601a55f47f29ea59e33c37e62db556 (patch) | |
tree | 946b82b7006ec374ce5f2d504361ba63626287e7 /llvm/lib/IR/ConstantFold.cpp | |
parent | 584ed8822631481ced8d3574cc1fed1585aed77d (diff) | |
download | llvm-7c69a03c56601a55f47f29ea59e33c37e62db556.zip llvm-7c69a03c56601a55f47f29ea59e33c37e62db556.tar.gz llvm-7c69a03c56601a55f47f29ea59e33c37e62db556.tar.bz2 |
[ConstantFold][SVE] Fix constant folding for shufflevector.
Don't try to fold away shuffles which can't be folded. Fix creation of
shufflevector constant expressions.
Differential Revision: https://reviews.llvm.org/D71147
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index bf01f9f..6e24f03 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -873,6 +873,12 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, // Don't break the bitcode reader hack. if (isa<ConstantExpr>(Mask)) return nullptr; + // Do not iterate on scalable vector. The num of elements is unknown at + // compile-time. + VectorType *ValTy = cast<VectorType>(V1->getType()); + if (ValTy->isScalable()) + return nullptr; + unsigned SrcNumElts = V1->getType()->getVectorNumElements(); // Loop over the shuffle mask, evaluating each element. |