From 4000afe712a7fd9e584919c43d2aa09b154946c1 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Sat, 31 Mar 2012 08:20:11 +0000 Subject: I noticed in passing that the Metadata getIfExists method was creating a new node and returning it if one didn't exist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153798 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Metadata.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/VMCore/Metadata.cpp') diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 0fc2a25..e3a08d4 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -205,11 +205,11 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef Vals, ID.AddPointer(Vals[i]); void *InsertPoint; - MDNode *N = NULL; - - if ((N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint))) + MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint); + + if (N || !Insert) return N; - + bool isFunctionLocal = false; switch (FL) { case FL_Unknown: -- cgit v1.1