forked from OSchip/llvm-project
[TargetLowering] Use isOneConstant to simplify some code. NFC
This commit is contained in:
parent
dd922bc2a6
commit
147c0c263d
|
@ -3780,8 +3780,7 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
|
|||
(N0.getOpcode() == ISD::AND &&
|
||||
N0.getOperand(0).getOpcode() == ISD::XOR &&
|
||||
N0.getOperand(1) == N0.getOperand(0).getOperand(1))) &&
|
||||
isa<ConstantSDNode>(N0.getOperand(1)) &&
|
||||
cast<ConstantSDNode>(N0.getOperand(1))->isOne()) {
|
||||
isOneConstant(N0.getOperand(1))) {
|
||||
// If this is (X^1) == 0/1, swap the RHS and eliminate the xor. We
|
||||
// can only do this if the top bits are known zero.
|
||||
unsigned BitWidth = N0.getValueSizeInBits();
|
||||
|
@ -3825,9 +3824,7 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
|
|||
return DAG.getSetCC(dl, VT, XorLHS, XorRHS, Cond);
|
||||
}
|
||||
}
|
||||
if (Op0.getOpcode() == ISD::AND &&
|
||||
isa<ConstantSDNode>(Op0.getOperand(1)) &&
|
||||
cast<ConstantSDNode>(Op0.getOperand(1))->isOne()) {
|
||||
if (Op0.getOpcode() == ISD::AND && isOneConstant(Op0.getOperand(1))) {
|
||||
// If this is (X&1) == / != 1, normalize it to (X&1) != / == 0.
|
||||
if (Op0.getValueType().bitsGT(VT))
|
||||
Op0 = DAG.getNode(ISD::AND, dl, VT,
|
||||
|
|
Loading…
Reference in New Issue