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

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 17:58:58 PST 2021


rahmanl created this revision.
Herald added subscribers: rupprecht, hiraditya, emaste.
Herald added a reviewer: jhenderson.
rahmanl updated this revision to Diff 329808.
rahmanl added a comment.
rahmanl retitled this revision from "Add fallthrough bit to BasicBlock Metadata." to "[llvm-readelf, propeller] Add fallthrough bit to basic block metadata in BB-Address-Map section.".
rahmanl edited the summary of this revision.
rahmanl added reviewers: shenhan, MaskRay.
rahmanl removed a reviewer: MaskRay.
rahmanl added a subscriber: MaskRay.
rahmanl added subscribers: tmsriram, snehasish.
rahmanl updated this revision to Diff 329811.
rahmanl published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Rebase after landing c245c21c436b <https://reviews.llvm.org/rGc245c21c436b5d29da62a7c416f08f8631f5df95>.


rahmanl added a comment.

Modify comment for `AsmPrinter::getBBAddrMapMetadata`.


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`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96918

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96918.329811.patch
Type: text/x-patch
Size: 4423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210311/732a9c67/attachment.bin>


More information about the llvm-commits mailing list