mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
A new dag combine; several permutations of this
are there under ADD, this one was missing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61107 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1178,6 +1178,12 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
|
||||
// fold (A+B)-B -> A
|
||||
if (N0.getOpcode() == ISD::ADD && N0.getOperand(1) == N1)
|
||||
return N0.getOperand(0);
|
||||
// fold ((A+(B-C))-B) -> A-C
|
||||
if (N0.getOpcode() == ISD::ADD &&
|
||||
N0.getOperand(1).getOpcode() == ISD::SUB &&
|
||||
N0.getOperand(1).getOperand(0) == N1)
|
||||
return DAG.getNode(ISD::SUB, VT, N0.getOperand(0),
|
||||
N0.getOperand(1).getOperand(1));
|
||||
// fold (sub x, (select cc, 0, c)) -> (select cc, x, (sub, x, c))
|
||||
if (N1.getOpcode() == ISD::SELECT && N1.getNode()->hasOneUse()) {
|
||||
SDValue Result = combineSelectAndUse(N, N1, N0, DAG, TLI, LegalOperations);
|
||||
|
Reference in New Issue
Block a user