[PATCH] D115393: [InstrProf][NFC] Refactor Profile kind into a bitset enum.

Snehasish Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 14:39:46 PST 2022


snehasish added inline comments.


================
Comment at: llvm/include/llvm/ProfileData/InstrProfReader.h:495
 
+  InstrProfKind getProfileKind() const override {
+    InstrProfKind ProfileKind = InstrProfKind::Unknown;
----------------
mtrofin wrote:
> This looks a lot like line 290, can it be refactored (or am I missing something?)
Since these were in a header but spread across different inherited classes of the same base I moved these to the .cpp and refactored it into a common static function in https://reviews.llvm.org/D118656. Thanks!


================
Comment at: llvm/lib/ProfileData/InstrProfWriter.cpp:337
   uint64_t CSSummarySize = 0;
-  if (ProfileKind == PF_IRLevelWithCS) {
+  if (static_cast<bool>(ProfileKind & InstrProfKind::CS)) {
     CSSummaryOffset = OS.tell();
----------------
mtrofin wrote:
> consider adding helper APIs for test/set?
I'm not sure it will help much but I'll take a look in the patch to rename the enum types to more descriptive names.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115393



More information about the cfe-commits mailing list