aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Metadata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Metadata.cpp')
-rw-r--r--lib/VMCore/Metadata.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp
index 73376f5..b894ea3 100644
--- a/lib/VMCore/Metadata.cpp
+++ b/lib/VMCore/Metadata.cpp
@@ -159,17 +159,9 @@ const Function *MDNode::getFunction() const {
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;
}