[llvm] [ProfileData] Teach getValueForSite to return ArrayRef<InstrProfValueData> (PR #95335)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 10:21:36 PDT 2024


================
@@ -869,14 +869,18 @@ struct InstrProfRecord {
   inline uint32_t getNumValueDataForSite(uint32_t ValueKind,
                                          uint32_t Site) const;
 
+  /// Return the array of profiled values at \p Site.
+  inline ArrayRef<InstrProfValueData> getValueForSite(uint32_t ValueKind,
+                                                      uint32_t Site) const;
+
   /// Return the array of profiled values at \p Site.
----------------
minglotus-6 wrote:

The new interface returns an ArrayRef and the deprecated interface allows caller to take ownership of the array.

I wonder if there are existing call sites where explicit ownership is preferred over a reference (e.g., easy to reason about lifecycle, etc).

https://github.com/llvm/llvm-project/pull/95335


More information about the llvm-commits mailing list