Skip to content

Commit 095b1c3

Browse files
- Move isLane0KnownActive before looking through reinterpret_cast
- Add comment to changes in canRemovePTestInstr
1 parent c5402af commit 095b1c3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27544,12 +27544,12 @@ static SDValue performPTestFirstCombine(SDNode *N,
2754427544
auto Mask = N->getOperand(0);
2754527545
auto Pred = N->getOperand(1);
2754627546

27547-
if (Pred->getOpcode() == AArch64ISD::REINTERPRET_CAST)
27548-
Pred = Pred->getOperand(0);
27549-
2755027547
if (!isLane0KnownActive(Mask))
2755127548
return SDValue();
2755227549

27550+
if (Pred->getOpcode() == AArch64ISD::REINTERPRET_CAST)
27551+
Pred = Pred->getOperand(0);
27552+
2755327553
if (Pred->getOpcode() == ISD::CONCAT_VECTORS) {
2755427554
Pred = Pred->getOperand(0);
2755527555
Pred = DAG.getNode(AArch64ISD::REINTERPRET_CAST, DL, MVT::nxv16i1, Pred);

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,9 @@ AArch64InstrInfo::canRemovePTestInstr(MachineInstr *PTest, MachineInstr *Mask,
15031503
getElementSizeForOpcode(PredOpcode))
15041504
return PredOpcode;
15051505

1506+
// For PTEST_FIRST(PTRUE_ALL, WHILE), the PTEST_FIRST is redundant since
1507+
// WHILEcc performs an implicit PTEST with an all active mask, setting
1508+
// the N flag as the PTEST_FIRST would.
15061509
if (PTest->getOpcode() == AArch64::PTEST_PP_FIRST &&
15071510
isPTrueOpcode(MaskOpcode) && Mask->getOperand(1).getImm() == 31)
15081511
return PredOpcode;

0 commit comments

Comments
 (0)