[all-commits] [llvm/llvm-project] 949abf: [llvm-readelf, propeller] Add fallthrough bit to b...

Rahman Lavaee via All-commits all-commits at lists.llvm.org
Mon Mar 22 21:39:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 949abf7d6afb9abd8d35bfb3ca2a1fb2e47a2c79
      https://github.com/llvm/llvm-project/commit/949abf7d6afb9abd8d35bfb3ca2a1fb2e47a2c79
  Author: Rahman Lavaee <rahmanl at google.com>
  Date:   2021-03-22 (Mon, 22 Mar 2021)

  Changed paths:
    M llvm/include/llvm/Object/ELFTypes.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
    M llvm/tools/llvm-readobj/ELFDumper.cpp

  Log Message:
  -----------
  [llvm-readelf, propeller] Add fallthrough bit to basic block metadata in BB-Address-Map section.

This patch adds a fallthrough bit to basic block metadata, indicating whether the basic block can fallthrough without taking any branches. The bit will help us avoid an intel LBR bug which results in occasional duplicate entries at the beginning of the LBR stack.

This patch uses `MachineBasicBlock::canFallThrough()` to set the bit. This is not a const method because it eventually calls `TargetInstrInfo::analyzeBranch`, but it calls this function with the default `AllowModify=false`. So we can either make the argument to the `getBBAddrMapMetadata` non-const, or we can use `const_cast` when calling `canFallThrough`. I decide to go with the latter since this is purely due to legacy code, and in general we should not allow the BasicBlock to be mutable during `getBBAddrMapMetadata`.

Reviewed By: tmsriram

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




More information about the All-commits mailing list