Skip to content

Commit 4f23767

Browse files
committed
[VPlan] Add m_FirstActiveLane matcher (NFC).
Add m_FirstActiveLane, to slightly simplify pattern matching in preparation for llvm/llvm-project#149042.
1 parent c4d7c42 commit 4f23767

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ m_AnyOf(const Op0_t &Op0) {
400400
return m_VPInstruction<VPInstruction::AnyOf>(Op0);
401401
}
402402

403+
template <typename Op0_t>
404+
inline VPInstruction_match<VPInstruction::FirstActiveLane, Op0_t>
405+
m_FirstActiveLane(const Op0_t &Op0) {
406+
return m_VPInstruction<VPInstruction::FirstActiveLane>(Op0);
407+
}
408+
403409
template <unsigned Opcode, typename Op0_t>
404410
inline AllRecipe_match<Opcode, Op0_t> m_Unary(const Op0_t &Op0) {
405411
return AllRecipe_match<Opcode, Op0_t>(Op0);

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,7 @@ static VPValue *optimizeEarlyExitInductionUser(VPlan &Plan,
788788
ScalarEvolution &SE) {
789789
VPValue *Incoming, *Mask;
790790
if (!match(Op, m_VPInstruction<VPInstruction::ExtractLane>(
791-
m_VPInstruction<VPInstruction::FirstActiveLane>(
792-
m_VPValue(Mask)),
793-
m_VPValue(Incoming))))
791+
m_FirstActiveLane(m_VPValue(Mask)), m_VPValue(Incoming))))
794792
return nullptr;
795793

796794
auto *WideIV = getOptimizableIVOf(Incoming, SE);

llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ void UnrollState::unrollBlock(VPBlockBase *VPB) {
352352
// Compute*Result which combine all parts to compute the final value.
353353
VPValue *Op1;
354354
if (match(&R, m_VPInstruction<VPInstruction::AnyOf>(m_VPValue(Op1))) ||
355-
match(&R, m_VPInstruction<VPInstruction::FirstActiveLane>(
356-
m_VPValue(Op1))) ||
355+
match(&R, m_FirstActiveLane(m_VPValue(Op1))) ||
357356
match(&R, m_VPInstruction<VPInstruction::ComputeAnyOfResult>(
358357
m_VPValue(), m_VPValue(), m_VPValue(Op1))) ||
359358
match(&R, m_VPInstruction<VPInstruction::ComputeReductionResult>(

0 commit comments

Comments
 (0)