[all-commits] [llvm/llvm-project] a1e218: [SamplePGO] Fixing a memory issue when creating pr...

Hongtao Yu via All-commits all-commits at lists.llvm.org
Mon Aug 16 16:30:43 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a1e21864df68dd38a308ad6fae965dea52dcde0c
      https://github.com/llvm/llvm-project/commit/a1e21864df68dd38a308ad6fae965dea52dcde0c
  Author: Hongtao Yu <hoy at fb.com>
  Date:   2021-08-16 (Mon, 16 Aug 2021)

  Changed paths:
    M llvm/include/llvm/ProfileData/SampleProf.h
    M llvm/include/llvm/ProfileData/SampleProfReader.h

  Log Message:
  -----------
  [SamplePGO] Fixing a memory issue when creating profiles on-demand

There is a on-dmeand creation of function profile during top-down processing in the sample loader when merging uninlined callees.  During the profile creation, a stack string object is used to store a newly-created MD5 name, which is then used by reference as hash key in the profile map. This makes the hash key a dangling reference when later on the stack string object is deallocated.

The issue only happens with md5 profile use and was exposed by context split work for CS profile. I'm making a fix by storing newly created names in the reader.

Reviewed By: wenlei, wmi, wlei

Differential Revision: https://reviews.llvm.org/D108142




More information about the All-commits mailing list