[PATCH] D13231: Change lookup functions to const functions.

Diego Novillo via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 08:39:19 PDT 2015


dnovillo added inline comments.

================
Comment at: include/llvm/ProfileData/SampleProf.h:195
@@ +194,3 @@
+  bool findSamplesAt(unsigned &Weight, int LineOffset,
+                     unsigned Discriminator) const {
+    const auto &ret = BodySamples.find(LineLocation(LineOffset, Discriminator));
----------------
Cleaner to use ErrorOr<unsigned> as the return value.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:220
@@ -215,1 +219,3 @@
+bool SampleProfileLoader::getInstWeight(unsigned &Weight,
+                                        const Instruction &Inst) const {
   DebugLoc DLoc = Inst.getDebugLoc();
----------------
Likewise here, change to return ErrorOr<unsigned>.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:231
@@ -231,1 +230,3 @@
+  return Samples->findSamplesAt(Weight, Lineno - HeaderLineno,
+                                DIL->getDiscriminator());
 }
----------------
Could you leave the DEBUG() code in?


http://reviews.llvm.org/D13231





More information about the llvm-commits mailing list