[PATCH] D159529: [BOLT][YAML] Only read first profile per function

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 20:11:45 PDT 2023


Amir added inline comments.


================
Comment at: bolt/lib/Profile/YAMLProfileReader.cpp:307
+      }
+      BF = nullptr;
+    }
----------------
Amir wrote:
> maksfb wrote:
> > Amir wrote:
> > > maksfb wrote:
> > > > Unneeded.
> > > It is needed because the attaching happens in lines 341-354. Preliminary exec count assignment is a suitable place where it's easy/cheap to check if the profile was attached already.
> > Then you need `auto &BF`.
> As discussed offline, this structured binding expands into reference types so modifying `BF` here has an effect.
Relevant note from Programmer's Manual: 

> Note that the elements are provided through a ‘reference wrapper’ proxy type (tuple of references), which combined with the structured bindings declaration makes Letter and Count references to range elements. Any modification to these references will affect the elements of Letters or Counts.
 
https://llvm.org/docs/ProgrammersManual.html#the-zip-functions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159529



More information about the llvm-commits mailing list