[llvm] [Offload][PGO] Fix dump of array in ProfData (PR #122039)
Ethan Luis McDonough via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 21:14:49 PST 2025
================
@@ -237,6 +237,9 @@ void GPUProfGlobals::dump() const {
outs() << "========== Data ===========\n";
for (const auto &ProfData : Data) {
outs() << "{ ";
+// The ProfData.Name maybe array, eg: NumValueSites[IPVK_Last+1] .
+// If we print out it directly, we are accessing out of bound data.
+// Skip dumping the array for now.
#define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
if (sizeof(#Name) > 2 && #Name[sizeof(#Name) - 2] == ']') { \
outs() << " [...]"; \
----------------
EthanLuisMcDonough wrote:
```suggestion
outs() << "[...] "; \
```
The test still fails on my end. It expects a space and a number after `[...]`, and right now the code outputs `[...]0`. Adding the space after the `[...]` fixes this.
https://github.com/llvm/llvm-project/pull/122039
More information about the llvm-commits
mailing list