Skip to content

Commit

Permalink
[ARM] Adjust AND/OR combines to not call isConstantSplat on i1 vector…
Browse files Browse the repository at this point in the history
…s. NFC.

The rearranges PerformANDCombine and PerformORCombine to try and make
sure we don't call isConstantSplat on any i1 vectors. As pointed out in
D81860 it may not be very well defined in those cases.
  • Loading branch information
davemgreen committed Jun 18, 2020
1 parent e3836fe commit 158e734
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions llvm/lib/Target/ARM/ARMISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12459,7 +12459,8 @@ static SDValue PerformANDCombine(SDNode *N,
EVT VT = N->getValueType(0);
SelectionDAG &DAG = DCI.DAG;

if(!DAG.getTargetLoweringInfo().isTypeLegal(VT))
if (!DAG.getTargetLoweringInfo().isTypeLegal(VT) || VT == MVT::v4i1 ||
VT == MVT::v8i1 || VT == MVT::v16i1)
return SDValue();

APInt SplatBits, SplatUndef;
Expand Down Expand Up @@ -12755,6 +12756,10 @@ static SDValue PerformORCombine(SDNode *N,
if(!DAG.getTargetLoweringInfo().isTypeLegal(VT))
return SDValue();

if (Subtarget->hasMVEIntegerOps() &&
(VT == MVT::v4i1 || VT == MVT::v8i1 || VT == MVT::v16i1))
return PerformORCombine_i1(N, DCI, Subtarget);

APInt SplatBits, SplatUndef;
unsigned SplatBitSize;
bool HasAnyUndefs;
Expand Down Expand Up @@ -12826,10 +12831,6 @@ static SDValue PerformORCombine(SDNode *N,
}
}

if (Subtarget->hasMVEIntegerOps() &&
(VT == MVT::v4i1 || VT == MVT::v8i1 || VT == MVT::v16i1))
return PerformORCombine_i1(N, DCI, Subtarget);

// Try to use the ARM/Thumb2 BFI (bitfield insert) instruction when
// reasonable.
if (N0.getOpcode() == ISD::AND && N0.hasOneUse()) {
Expand Down

0 comments on commit 158e734

Please sign in to comment.