File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
llvm/lib/CodeGen/SelectionDAG Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -7399,16 +7399,13 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
7399
7399
//
7400
7400
// Note: the SimplifyDemandedBits fold below can make an information-losing
7401
7401
// transform, and then we have no way to find this better fold.
7402
- if (N1C && N1C->isOne() && N0.getOpcode() == ISD::SUB) {
7403
- if (isNullOrNullSplat(N0.getOperand(0))) {
7404
- SDValue SubRHS = N0.getOperand(1);
7405
- if (SubRHS.getOpcode() == ISD::ZERO_EXTEND &&
7406
- SubRHS.getOperand(0).getScalarValueSizeInBits() == 1)
7407
- return SubRHS;
7408
- if (SubRHS.getOpcode() == ISD::SIGN_EXTEND &&
7409
- SubRHS.getOperand(0).getScalarValueSizeInBits() == 1)
7410
- return DAG.getNode(ISD::ZERO_EXTEND, DL, VT, SubRHS.getOperand(0));
7411
- }
7402
+ if (sd_match(N, m_And(m_Sub(m_Zero(), m_Value(X)), m_One()))) {
7403
+ if (X.getOpcode() == ISD::ZERO_EXTEND &&
7404
+ X.getOperand(0).getScalarValueSizeInBits() == 1)
7405
+ return X;
7406
+ if (X.getOpcode() == ISD::SIGN_EXTEND &&
7407
+ X.getOperand(0).getScalarValueSizeInBits() == 1)
7408
+ return DAG.getNode(ISD::ZERO_EXTEND, DL, VT, X.getOperand(0));
7412
7409
}
7413
7410
7414
7411
// fold (and (sign_extend_inreg x, i16 to i32), 1) -> (and x, 1)
You can’t perform that action at this time.
0 commit comments