forked from OSchip/llvm-project
[DAGCombiner] Remove (xor (xor x, c1), c2) -> (xor x, (xor c1, c2)) fold. NFCI.
More general cases are already handled by constant canonicalization and then the ReassociateOps call at line 5327 llvm-svn: 321280
This commit is contained in:
parent
6b915d3353
commit
695c7da3d5
|
@ -5392,21 +5392,6 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
|
|||
AddToWorklist(NotX.getNode());
|
||||
return DAG.getNode(ISD::AND, SDLoc(N), VT, NotX, N1);
|
||||
}
|
||||
// fold (xor (xor x, c1), c2) -> (xor x, (xor c1, c2))
|
||||
if (N1C && N0.getOpcode() == ISD::XOR) {
|
||||
if (const ConstantSDNode *N00C = getAsNonOpaqueConstant(N0.getOperand(0))) {
|
||||
SDLoc DL(N);
|
||||
return DAG.getNode(ISD::XOR, DL, VT, N0.getOperand(1),
|
||||
DAG.getConstant(N1C->getAPIntValue() ^
|
||||
N00C->getAPIntValue(), DL, VT));
|
||||
}
|
||||
if (const ConstantSDNode *N01C = getAsNonOpaqueConstant(N0.getOperand(1))) {
|
||||
SDLoc DL(N);
|
||||
return DAG.getNode(ISD::XOR, DL, VT, N0.getOperand(0),
|
||||
DAG.getConstant(N1C->getAPIntValue() ^
|
||||
N01C->getAPIntValue(), DL, VT));
|
||||
}
|
||||
}
|
||||
|
||||
// fold Y = sra (X, size(X)-1); xor (add (X, Y), Y) -> (abs X)
|
||||
unsigned OpSizeInBits = VT.getScalarSizeInBits();
|
||||
|
|
Loading…
Reference in New Issue