[PATCH] D24843: Move computation past early return

Aditya Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 13:48:57 PDT 2016


hiraditya created this revision.
hiraditya added reviewers: rafael, spatel.
hiraditya added a subscriber: llvm-commits.

https://reviews.llvm.org/D24843

Files:
  llvm/lib/IR/Metadata.cpp

Index: llvm/lib/IR/Metadata.cpp
===================================================================
--- llvm/lib/IR/Metadata.cpp
+++ llvm/lib/IR/Metadata.cpp
@@ -1164,14 +1164,13 @@
 }
 
 void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
-  SmallSet<unsigned, 5> KnownSet;
-  KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
-
   if (!hasMetadataHashEntry())
     return; // Nothing to remove!
 
   auto &InstructionMetadata = getContext().pImpl->InstructionMetadata;
 
+  SmallSet<unsigned, 4> KnownSet;
+  KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
   if (KnownSet.empty()) {
     // Just drop our entry at the store.
     InstructionMetadata.erase(this);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24843.72209.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160922/3dd2e741/attachment.bin>


More information about the llvm-commits mailing list