[all-commits] [llvm/llvm-project] 5617fb: [MLGO][NFC] Use std::map instead of DenseMap to av...

Mircea Trofin via All-commits all-commits at lists.llvm.org
Fri Nov 4 16:07:51 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5617fb1411f765667c016b5b75daa9d1110c36af
      https://github.com/llvm/llvm-project/commit/5617fb1411f765667c016b5b75daa9d1110c36af
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2022-11-04 (Fri, 04 Nov 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/MLInlineAdvisor.h
    M llvm/lib/Analysis/MLInlineAdvisor.cpp

  Log Message:
  -----------
  [MLGO][NFC] Use std::map instead of DenseMap to avoid use after free

In `MLInlineAdvisor::getAdviceImpl`, we call `getCachedFPI` twice, once
for the caller, once for the callee, so the second may invalidate the
reference obtained by the first because the underlying implementation of
the cache is a `DenseMap`. `std::map` doesn't have that problem.




More information about the All-commits mailing list