mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 19:42:54 +02:00
add a trivial fold
llvm-svn: 23764
This commit is contained in:
parent
7a61ff2741
commit
27d166c9bf
@ -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…
Reference in New Issue
Block a user