[PATCH] D13914: Tolerate negative offset when matching sample profile.

Diego Novillo via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 14:42:58 PDT 2015


dnovillo added inline comments.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:233
@@ -234,3 +232,3 @@
 
-  ErrorOr<uint64_t> R =
-      FS->findSamplesAt(Lineno - HeaderLineno, DIL->getDiscriminator());
+  ErrorOr<uint64_t> R = FS->findSamplesAt((Lineno - HeaderLineno) & 0xffff,
+                                          DIL->getDiscriminator());
----------------
Could you factor out this offset computation and add a comment?  It's not immediately obvious why the code is doing this saturation and it's used in several places.  Also, what's guaranteeing that the saturation will be done on 16 bits?


http://reviews.llvm.org/D13914





More information about the llvm-commits mailing list