[PATCH] D23082: [AutoFDO] Fix handling of empty profiles

David Callahan via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 11:46:05 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL277849: [AutoFDO] Fix handling of empty profiles (authored by david2050).

Changed prior to commit:
  https://reviews.llvm.org/D23082?vs=66542&id=66988#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23082

Files:
  llvm/trunk/lib/IR/Function.cpp

Index: llvm/trunk/lib/IR/Function.cpp
===================================================================
--- llvm/trunk/lib/IR/Function.cpp
+++ llvm/trunk/lib/IR/Function.cpp
@@ -1262,7 +1262,10 @@
     if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0)))
       if (MDS->getString().equals("function_entry_count")) {
         ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1));
-        return CI->getValue().getZExtValue();
+        uint64_t Count = CI->getValue().getZExtValue();
+        if (Count == 0)
+          return None;
+        return Count;
       }
   return None;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23082.66988.patch
Type: text/x-patch
Size: 606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/be6d4c34/attachment.bin>


More information about the llvm-commits mailing list