[PATCH] D78267: [InstCombine][SVE] Fix visitExtractElementInst for scalable type.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 11:49:06 PDT 2020
efriedma added inline comments.
================
Comment at: llvm/lib/Analysis/VectorUtils.cpp:292
if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(V)) {
- unsigned LHSWidth =
- cast<VectorType>(SVI->getOperand(0)->getType())->getNumElements();
- int InEl = SVI->getMaskValue(EltNo);
- if (InEl < 0)
- return UndefValue::get(VTy->getElementType());
- if (InEl < (int)LHSWidth)
- return findScalarElement(SVI->getOperand(0), InEl);
- return findScalarElement(SVI->getOperand(1), InEl - LHSWidth);
+ // Make sure EltNo has valid record in shuffle mask if SVI is scalable type.
+ if (EltNo < SVI->getShuffleMask().size()) {
----------------
I think I'd prefer to avoid calling getMaskValue() and trying to compute LHSWidth for scalable vectors; it's not clear what it should mean.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:432
+ ->getElementCount()
+ .Min;
+
----------------
Same as above.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78267/new/
https://reviews.llvm.org/D78267
More information about the llvm-commits
mailing list