[PATCH] D61609: [llvm] Handle missing debug info when updating sample counts

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 21:20:52 PDT 2019


mtrofin marked 3 inline comments as done.
mtrofin added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:1667
+
+  if (WantAccurateProfile && getFunctionLoc(F) == 0) {
+    // We won't be able to match samples. Reset all !prof metadata.
----------------
davidxl wrote:
> why 'WantAccurateProfile' guard?
To avoid breaking existing tests & code. When we don't want accurate profiles, we set the entry count to -1 ("invalid"), which is recognized by existing code and handled appropriately.

However, come to think of it, that would still leave the prof data valid within the function. For consistency, we could perhaps set those to -1 as well.

I would prefer changing the current behavior in the non-precise case in a separate CL - thoughts?


================
Comment at: llvm/test/Transforms/SampleProfile/entry_counts_missing_dbginfo.ll:7
+; - we don't have debug info for the function. This means we can't match sample counts in the profile to locations in this function.
+; When this function is not inlined, we'll attempt to update its profile info, as well as that of calls within the function.
+; This would result in a div by 0, unless we handle this scenario.
----------------
davidxl wrote:
> Needs clarification. When the function is not inlined, why is there need to update its profile? Can you point to the compiler source that does this?
Added more detail.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61609/new/

https://reviews.llvm.org/D61609





More information about the llvm-commits mailing list