Skip to content

Commit 16a88d9

Browse files
committed
fixup! Address review comments
1 parent 1afd2cc commit 16a88d9

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

llvm/lib/CodeGen/InterleavedAccessPass.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -634,37 +634,28 @@ getVectorDeinterleaveFactor(IntrinsicInst *II,
634634
// mask.
635635
static Value *getMask(Value *WideMask, unsigned Factor,
636636
VectorType *LeafValueTy) {
637-
Value *MaskVal = nullptr;
638-
639637
using namespace llvm::PatternMatch;
640638
if (auto *IMI = dyn_cast<IntrinsicInst>(WideMask)) {
641639
SmallVector<Value *, 8> Operands;
642640
SmallVector<Instruction *, 8> DeadInsts;
643641
if (getVectorInterleaveFactor(IMI, Operands, DeadInsts)) {
644642
assert(!Operands.empty());
645643
if (Operands.size() == Factor && llvm::all_equal(Operands))
646-
MaskVal = Operands[0];
644+
return Operands[0];
647645
}
648646
}
649647

650648
if (match(WideMask, m_AllOnes())) {
651-
// Scale the vector length.
649+
// Scale the vector length of all-ones mask.
652650
ElementCount OrigEC =
653651
cast<VectorType>(WideMask->getType())->getElementCount();
654-
MaskVal =
655-
ConstantVector::getSplat(OrigEC.divideCoefficientBy(Factor),
656-
cast<Constant>(WideMask)->getSplatValue());
657-
}
658-
659-
if (MaskVal) {
660-
// Check if the vector length of mask matches that of the leaf values.
661-
auto *MaskTy = cast<VectorType>(MaskVal->getType());
662-
if (!MaskTy->getElementType()->isIntegerTy(/*Bitwidth=*/1) ||
663-
MaskTy->getElementCount() != LeafValueTy->getElementCount())
652+
if (OrigEC.getKnownMinValue() % Factor)
664653
return nullptr;
654+
return ConstantVector::getSplat(OrigEC.divideCoefficientBy(Factor),
655+
cast<Constant>(WideMask)->getSplatValue());
665656
}
666657

667-
return MaskVal;
658+
return nullptr;
668659
}
669660

670661
bool InterleavedAccessImpl::lowerDeinterleaveIntrinsic(

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22538,12 +22538,12 @@ static bool isMultipleOfN(const Value *V, const DataLayout &DL, unsigned N) {
2253822538
if (isPowerOf2_32(N)) {
2253922539
KnownBits KB = llvm::computeKnownBits(V, DL);
2254022540
return KB.countMinTrailingZeros() >= Log2_32(N);
22541-
} else {
22542-
using namespace PatternMatch;
22543-
// Right now we're only recognizing the simplest pattern.
22544-
uint64_t C;
22545-
return match(V, m_c_Mul(m_Value(), m_ConstantInt(C))) && C && C % N == 0;
2254622541
}
22542+
22543+
using namespace PatternMatch;
22544+
// Right now we're only recognizing the simplest pattern.
22545+
uint64_t C;
22546+
return match(V, m_c_Mul(m_Value(), m_ConstantInt(C))) && C && C % N == 0;
2254722547
}
2254822548

2254922549
/// Lower an interleaved vp.load into a vlsegN intrinsic.

0 commit comments

Comments
 (0)