Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.305 -> 1.306 --- Log message: Use a ptr set instead of a linear search to unique TokenFactor operands. This fixes PR1423: http://llvm.org/PR1423 --- Diffs of the changes: (+13 -10) DAGCombiner.cpp | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.305 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.306 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.305 Tue May 15 21:04:50 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed May 16 01:37:59 2007 @@ -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 @@ 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 @@ // 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; } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits