[all-commits] [llvm/llvm-project] 68106b: [Sample Profile Loader] Fix potential invalidated...

William Junda Huang via All-commits all-commits at lists.llvm.org
Wed Nov 29 13:49:09 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 68106bd492e294ecf0a7e2829dd9edf6cd72f3ef
      https://github.com/llvm/llvm-project/commit/68106bd492e294ecf0a7e2829dd9edf6cd72f3ef
  Author: William Junda Huang <williamjhuang at google.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h

  Log Message:
  -----------
  [Sample Profile Loader]  Fix potential invalidated reference (#73181)

There is a potential issue in ProfiledCallGraph where pointers to
ProfiledCallGraphNode are used to construct edges, while
ProfiledCallGraphNode instances are being added to a hash map
ProfiledFunctions simultaneously. If rehash happens, those pointers are
invalidated, resulting in undefined behavior/crash. Previously (before
md5phase2) ProfiledFunctions is a llvm::StringMap, which also have the
same issue theoretically when rehashing but was not observed. This patch
fixes this potential issue by using a backing buffer for
ProrfiledCallGraphNode that does not relocate.




More information about the All-commits mailing list