summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-16 06:37:59 +0000
committerChris Lattner <sabre@nondot.org>2007-05-16 06:37:59 +0000
commit48fb92f75d548241c4103d734f958f1ed04aa4cc (patch)
treef97fb5698332ceea6c800942d59513123715c48b /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent1087473e515b81de75cb6785bd567cb4e2d0c85c (diff)
downloadbcm5719-llvm-48fb92f75d548241c4103d734f958f1ed04aa4cc.tar.gz
bcm5719-llvm-48fb92f75d548241c4103d734f958f1ed04aa4cc.zip
Use a ptr set instead of a linear search to unique TokenFactor operands.
This fixes PR1423 llvm-svn: 37102
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 2ea38e20902..b3a448af84a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -29,17 +29,18 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "dagcombine"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/SelectionDAG.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/MathExtras.h"
+#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/MathExtras.h"
#include <algorithm>
using namespace llvm;
@@ -713,10 +714,10 @@ SDOperand DAGCombiner::visitTokenFactor(SDNode *N) {
return N->getOperand(1);
}
-
- SmallVector<SDNode *, 8> TFs; // List of token factors to visit.
- SmallVector<SDOperand, 8> Ops; // Ops for replacing token factor.
- bool Changed = false; // If we should replace this token factor.
+ SmallVector<SDNode *, 8> TFs; // List of token factors to visit.
+ SmallVector<SDOperand, 8> Ops; // Ops for replacing token factor.
+ SmallPtrSet<SDNode*, 16> SeenOps;
+ bool Changed = false; // If we should replace this token factor.
// Start out with this token factor.
TFs.push_back(N);
@@ -750,9 +751,11 @@ SDOperand DAGCombiner::visitTokenFactor(SDNode *N) {
// Fall thru
default:
- // Only add if not there prior.
- if (std::find(Ops.begin(), Ops.end(), Op) == Ops.end())
+ // Only add if it isn't already in the list.
+ if (SeenOps.insert(Op.Val))
Ops.push_back(Op);
+ else
+ Changed = true;
break;
}
}
OpenPOWER on IntegriCloud