diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-12 05:01:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-12 05:01:37 +0000 |
commit | 66adee93aa628c2781c9e54afd7cdbf26edc86e8 (patch) | |
tree | 726ab0f795a892471b30ec97c49d4cb7f0e8ed18 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 1501b9f829b23e1aafb1110560f16a83dcf8a346 (diff) | |
download | bcm5719-llvm-66adee93aa628c2781c9e54afd7cdbf26edc86e8.tar.gz bcm5719-llvm-66adee93aa628c2781c9e54afd7cdbf26edc86e8.zip |
Two simplifications for token factor nodes: simplify tf(x,x) -> x.
simplify tf(x,y,y,z) -> tf(x,y,z).
llvm-svn: 28233
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index af3d38a0111..0aaee2f0432 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -680,7 +680,8 @@ SDOperand DAGCombiner::visitTokenFactor(SDNode *N) { // If the token factor has two operands and one is the entry token, replace // the token factor with the other operand. if (N->getNumOperands() == 2) { - if (N->getOperand(0).getOpcode() == ISD::EntryToken) + if (N->getOperand(0).getOpcode() == ISD::EntryToken || + N->getOperand(0) == N->getOperand(1)) return N->getOperand(1); if (N->getOperand(1).getOpcode() == ISD::EntryToken) return N->getOperand(0); @@ -694,8 +695,11 @@ SDOperand DAGCombiner::visitTokenFactor(SDNode *N) { Changed = true; for (unsigned j = 0, e = Op.getNumOperands(); j != e; ++j) Ops.push_back(Op.getOperand(j)); - } else { + } else if (i == 0 || N->getOperand(i) != N->getOperand(i-1)) { Ops.push_back(Op); + } else { + // Deleted an operand that was the same as the last one. + Changed = true; } } if (Changed) |