From: Aditya Kumar Date: Mon, 26 Sep 2016 21:01:13 +0000 (+0000) Subject: Move computation past early return X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=077587918120834a75d51289060a5db84e74111e;p=llvm Move computation past early return Reviewers: rafael spatel Differential Revision: https://reviews.llvm.org/D24843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282440 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Metadata.cpp b/lib/IR/Metadata.cpp index 51ef2fad7ef..d4312c8b253 100644 --- a/lib/IR/Metadata.cpp +++ b/lib/IR/Metadata.cpp @@ -1154,14 +1154,13 @@ MDNode *Instruction::getMetadataImpl(StringRef Kind) const { } void Instruction::dropUnknownNonDebugMetadata(ArrayRef KnownIDs) { - SmallSet KnownSet; - KnownSet.insert(KnownIDs.begin(), KnownIDs.end()); - if (!hasMetadataHashEntry()) return; // Nothing to remove! auto &InstructionMetadata = getContext().pImpl->InstructionMetadata; + SmallSet KnownSet; + KnownSet.insert(KnownIDs.begin(), KnownIDs.end()); if (KnownSet.empty()) { // Just drop our entry at the store. InstructionMetadata.erase(this);