buildbot: the debugging and non-debugging versions of getFunction were not
functionally equivalent: the non-debugging version wrongly assumed that if a
metadata operand was not metadata, then it had a non-null containing function.
This is not true, since the operand might be a global value, constant etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103008
91177308-0d34-0410-b5e6-
96231b3b80d8
return assertLocalFunction(this);
#endif
if (!isFunctionLocal()) return NULL;
-
- for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
- if (Value *V = getOperand(i)) {
- if (MDNode *MD = dyn_cast<MDNode>(V)) {
- if (const Function *F = MD->getFunction())
- return F;
- } else {
- return getFunctionForValue(V);
- }
- }
- }
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+ if (const Function *F = getFunctionForValue(getOperand(i)))
+ return F;
return NULL;
}