[all-commits] [llvm/llvm-project] 287306: [SHT_LLVM_BB_ADDR_MAP] Fixes two bugs in decoding ...

Micah Weston via All-commits all-commits at lists.llvm.org
Fri Jan 5 19:00:04 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2873060f3cfbd92dcff8d1037a08e9fb60f7882e
      https://github.com/llvm/llvm-project/commit/2873060f3cfbd92dcff8d1037a08e9fb60f7882e
  Author: Micah Weston <micahsweston at gmail.com>
  Date:   2024-01-05 (Fri, 05 Jan 2024)

  Changed paths:
    M llvm/include/llvm/Object/ELFTypes.h
    M llvm/lib/Object/ELF.cpp
    M llvm/unittests/Object/ELFObjectFileTest.cpp

  Log Message:
  -----------
  [SHT_LLVM_BB_ADDR_MAP] Fixes two bugs in decoding of PGOAnalyses in BBAddrMap. (#77139)

We had specified that `readBBAddrMap` will always keep PGOAnalyses and
BBAddrMaps the same length on success.

https://github.com/llvm/llvm-project/blob/365fbbfbcfefb8766f7716109b9c3767b58e6058/llvm/include/llvm/Object/ELFObjectFile.h#L116-L117

It turns out that this is not currently the case when no analyses exist
in a function. No test had caught it.

We also should not append PGOBBEntries when there is no BBFreq or
BrProb.

This patch adds:
* tests that PGOAnalyses and BBAddrMaps are same length even when no
analyses are enabled
* fixes decode so that PGOAnalyses and BBAddrMaps are same length
* updates test to not emit unnecessary PGOBBEntries
* fixes decode to not emit PGOBBEntries when unnecessary




More information about the All-commits mailing list