[llvm] [memprof] Add MemProf version (PR #86414)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 14:18:31 PDT 2024


dyung wrote:

> > Can you take a look?
> 
> @dyung Do you get similar errors on `llvm/lib/ProfileData/InstrProfWriter.cpp`?
> 
> At `llvm/lib/ProfileData/InstrProfReader.cpp:1255`, the types of the arguments to `formatv` are:
> 
> 1. `const char[80]`
> 2. `const uint64_t`
> 3. `const uint64_t`
> 4. `const uint64_t`
> 
> At `llvm/lib/ProfileData/InstrProfWriter.cpp:538`, the types of the arguments to `formatv` are:
> 
> 1. `const char[80]`
> 2. `memprof::IndexedVersion` (whose underlying type is `uint64_t`)
> 3. `const uint64_t`
> 4. `const uint64_t`
> 
> I am guessing that if `const uint64_t` is problematic, `InstrProfWriter.cpp` should trigger similar errors.
> 
> With all that said, it's possible for your build system to terminate the build upon the first error. It may not have a chance to get to `InstrProfWriter.cpp` if it encounters an error with `InstrProfReader.cpp` first.

We do see the same errors with `llvm/lib/ProfileData/InstrProfWriter.cpp`, I left it out since fixing one should fix both I think, sorry about that.

I was able to work around the issue with `llvm::detail` by explicitly specifying `llvm::detail` at line `llvm/include/llvm/Support/FormatProviders.h:129`.
```diff
diff --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h
index aa0773847161..a83179f014b1 100644
--- a/llvm/include/llvm/Support/FormatProviders.h
+++ b/llvm/include/llvm/Support/FormatProviders.h
@@ -126,7 +126,7 @@ protected:
 template <typename T>
 struct format_provider<
     T, std::enable_if_t<detail::use_integral_formatter<T>::value>>
-    : public detail::HelperFunctions {
+    : public llvm::detail::HelperFunctions {
 private:
 public:
   static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) {
```
I'm still trying to figure out how to get the compiler to find the correct overload for `formatv` though.

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


More information about the llvm-commits mailing list