diff options
| author | Dan Gohman <gohman@apple.com> | 2009-01-27 19:04:30 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-01-27 19:04:30 +0000 | 
| commit | f77f0ce21aaba21df9754fa4e7332d300af0bb31 (patch) | |
| tree | 49cf993738c1140b3103bcb734aefc6117069f2b | |
| parent | 75441a3870fdd29668513b6978798f9d223e78c5 (diff) | |
| download | bcm5719-llvm-f77f0ce21aaba21df9754fa4e7332d300af0bb31.tar.gz bcm5719-llvm-f77f0ce21aaba21df9754fa4e7332d300af0bb31.zip | |
Simplify findNonImmUse; return the result using the return value
instead of via a by-reference argument. No functionality change.
llvm-svn: 63118
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 30 | 
1 files changed, 14 insertions, 16 deletions
| diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index c5a6edd87a7..54b04ecabc6 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -249,30 +249,30 @@ static SDNode *findFlagUse(SDNode *N) {    return NULL;  } -/// findNonImmUse - Return true by reference in "found" if "Use" is an -/// non-immediate use of "Def". This function recursively traversing -/// up the operand chain ignoring certain nodes. -static void findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse, -                          SDNode *Root, bool &found, +/// findNonImmUse - Return true if "Use" is a non-immediate use of "Def". +/// This function recursively traverses up the operand chain, ignoring +/// certain nodes. +static bool findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse, +                          SDNode *Root,                            SmallPtrSet<SDNode*, 16> &Visited) { -  if (found || -      Use->getNodeId() < Def->getNodeId() || +  if (Use->getNodeId() < Def->getNodeId() ||        !Visited.insert(Use)) -    return; -   -  for (unsigned i = 0, e = Use->getNumOperands(); !found && i != e; ++i) { +    return false; + +  for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {      SDNode *N = Use->getOperand(i).getNode();      if (N == Def) {        if (Use == ImmedUse || Use == Root)          continue;  // We are not looking for immediate use.        assert(N != Root); -      found = true; -      break; +      return true;      }      // Traverse up the operand chain. -    findNonImmUse(N, Def, ImmedUse, Root, found, Visited); +    if (findNonImmUse(N, Def, ImmedUse, Root, Visited)) +      return true;    } +  return false;  }  /// isNonImmUse - Start searching from Root up the DAG to check is Def can @@ -287,9 +287,7 @@ static void findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,  /// its chain operand.  static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse) {    SmallPtrSet<SDNode*, 16> Visited; -  bool found = false; -  findNonImmUse(Root, Def, ImmedUse, Root, found, Visited); -  return found; +  return findNonImmUse(Root, Def, ImmedUse, Root, Visited);  } | 

