summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-12 05:01:37 +0000
committerChris Lattner <sabre@nondot.org>2006-05-12 05:01:37 +0000
commit21a57dc75172aa964c51d386b2cdd0ad3be7792f (patch)
tree83b95fbbdb06e202ebeacde3161a7d54dc8749a4 /lib/CodeGen
parent29225b1d3200ac056438d037974bd284003f0ab5 (diff)
downloadllvm-21a57dc75172aa964c51d386b2cdd0ad3be7792f.tar.gz
llvm-21a57dc75172aa964c51d386b2cdd0ad3be7792f.tar.bz2
llvm-21a57dc75172aa964c51d386b2cdd0ad3be7792f.tar.xz
Two simplifications for token factor nodes: simplify tf(x,x) -> x.
simplify tf(x,y,y,z) -> tf(x,y,z). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index af3d38a011..0aaee2f043 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/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)