mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
add a trivial fold
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23764 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7a025c8b4d
commit
854077d3a5
@ -532,6 +532,10 @@ SDOperand DAGCombiner::visitSUB(SDNode *N) {
|
||||
ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0.Val);
|
||||
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.Val);
|
||||
|
||||
// fold (sub x, x) -> 0
|
||||
if (N0 == N1)
|
||||
return DAG.getConstant(0, N->getValueType(0));
|
||||
|
||||
// fold (sub c1, c2) -> c1-c2
|
||||
if (N0C && N1C)
|
||||
return DAG.getConstant(N0C->getValue() - N1C->getValue(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user