[PATCH] D102007: [CSSPGO] Fix return value of getProbeWeight

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 7 16:30:35 PDT 2021


hoy added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:566
   if (!FS)
-    return std::error_code();
+    return 0;
 
----------------
wenlei wrote:
> Given it more thought, perhaps whether this is 0 or error_code is subject to something like `profile-sample-accurate`? I.e. with that flag, it means cold, otherwise it means unknown (error_code)?
> 
> The default behavior for `getInstWeight` the AutoFDO counterpart is returning error_code here. We don't have to do it now, but may be both AutoFDO and CSSPGO can check `profile-sample-accurate` here to decide between 0 or error_code? @wmi what do you think about AutoFDO?
Good point. Was thinking about this. When it comes here, `Inst` should be mostly from a function that has a profile, like

- If it is from a top-level inliner, the inliner should have a profile, otherwise it wouldn't be compiled.
- If it is from an inlinee, the inlinee should have a profile, otherwise it wouldn't be inlined (see `SampleProfileLoader::getInlineCandidate`).






Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102007



More information about the llvm-commits mailing list