mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-20 10:38:46 +00:00
Simplify findNonImmUse; return the result using the return value
instead of via a by-reference argument. No functionality change. llvm-svn: 63118
This commit is contained in:
parent
47c303034d
commit
7d80f8688e
@ -249,30 +249,30 @@ static SDNode *findFlagUse(SDNode *N) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// findNonImmUse - Return true by reference in "found" if "Use" is an
|
/// findNonImmUse - Return true if "Use" is a non-immediate use of "Def".
|
||||||
/// non-immediate use of "Def". This function recursively traversing
|
/// This function recursively traverses up the operand chain, ignoring
|
||||||
/// up the operand chain ignoring certain nodes.
|
/// certain nodes.
|
||||||
static void findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,
|
static bool findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,
|
||||||
SDNode *Root, bool &found,
|
SDNode *Root,
|
||||||
SmallPtrSet<SDNode*, 16> &Visited) {
|
SmallPtrSet<SDNode*, 16> &Visited) {
|
||||||
if (found ||
|
if (Use->getNodeId() < Def->getNodeId() ||
|
||||||
Use->getNodeId() < Def->getNodeId() ||
|
|
||||||
!Visited.insert(Use))
|
!Visited.insert(Use))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
for (unsigned i = 0, e = Use->getNumOperands(); !found && i != e; ++i) {
|
for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
|
||||||
SDNode *N = Use->getOperand(i).getNode();
|
SDNode *N = Use->getOperand(i).getNode();
|
||||||
if (N == Def) {
|
if (N == Def) {
|
||||||
if (Use == ImmedUse || Use == Root)
|
if (Use == ImmedUse || Use == Root)
|
||||||
continue; // We are not looking for immediate use.
|
continue; // We are not looking for immediate use.
|
||||||
assert(N != Root);
|
assert(N != Root);
|
||||||
found = true;
|
return true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Traverse up the operand chain.
|
// 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
|
/// 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.
|
/// its chain operand.
|
||||||
static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse) {
|
static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse) {
|
||||||
SmallPtrSet<SDNode*, 16> Visited;
|
SmallPtrSet<SDNode*, 16> Visited;
|
||||||
bool found = false;
|
return findNonImmUse(Root, Def, ImmedUse, Root, Visited);
|
||||||
findNonImmUse(Root, Def, ImmedUse, Root, found, Visited);
|
|
||||||
return found;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user