Eliminate some std::sets. This speeds up isel of kimwitu by about 0.9%

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-02-04 00:24:41 +00:00
parent a3e60626b4
commit d48c5e871a

View File

@@ -24,9 +24,9 @@
#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
#include <set>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
using namespace llvm; using namespace llvm;
@@ -2548,12 +2548,12 @@ bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const {
SDOperand TheValue(const_cast<SDNode *>(this), Value); SDOperand TheValue(const_cast<SDNode *>(this), Value);
std::set<SDNode*> UsersHandled; SmallPtrSet<SDNode*, 32> UsersHandled;
for (SDNode::use_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) { for (SDNode::use_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) {
SDNode *User = *UI; SDNode *User = *UI;
if (User->getNumOperands() == 1 || if (User->getNumOperands() == 1 ||
UsersHandled.insert(User).second) // First time we've seen this? UsersHandled.insert(User)) // First time we've seen this?
for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i)
if (User->getOperand(i) == TheValue) { if (User->getOperand(i) == TheValue) {
if (NUses == 0) if (NUses == 0)
@@ -2599,8 +2599,8 @@ bool SDNode::isOperand(SDNode *N) const {
} }
static void findPredecessor(SDNode *N, const SDNode *P, bool &found, static void findPredecessor(SDNode *N, const SDNode *P, bool &found,
std::set<SDNode *> &Visited) { SmallPtrSet<SDNode *, 32> &Visited) {
if (found || !Visited.insert(N).second) if (found || !Visited.insert(N))
return; return;
for (unsigned i = 0, e = N->getNumOperands(); !found && i != e; ++i) { for (unsigned i = 0, e = N->getNumOperands(); !found && i != e; ++i) {
@@ -2618,7 +2618,7 @@ static void findPredecessor(SDNode *N, const SDNode *P, bool &found,
/// up the operands. /// up the operands.
/// NOTE: this is an expensive method. Use it carefully. /// NOTE: this is an expensive method. Use it carefully.
bool SDNode::isPredecessor(SDNode *N) const { bool SDNode::isPredecessor(SDNode *N) const {
std::set<SDNode *> Visited; SmallPtrSet<SDNode *, 32> Visited;
bool found = false; bool found = false;
findPredecessor(N, this, found, Visited); findPredecessor(N, this, found, Visited);
return found; return found;