[all-commits] [llvm/llvm-project] 408349: [BFI] Use CallbackVH to notify BFI about deletion ...

Daniil Suchkov via All-commits all-commits at lists.llvm.org
Thu Mar 5 03:11:30 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 408349a25d0f5a012003f84c95b49bcc7782fa70
      https://github.com/llvm/llvm-project/commit/408349a25d0f5a012003f84c95b49bcc7782fa70
  Author: Daniil Suchkov <suc-daniil at yandex.ru>
  Date:   2020-03-05 (Thu, 05 Mar 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
    M llvm/include/llvm/IR/ValueHandle.h

  Log Message:
  -----------
  [BFI] Use CallbackVH to notify BFI about deletion of basic blocks

With AssertingVHs instead of bare pointers in
BlockFrequencyInfoImpl::Nodes (but without CallbackVHs) ~1/36 of all
tests ran by make check fail. It means that there are users of BFI that
delete basic blocks while keeping BFI. Some of those transformations add
new basic blocks, so if a new basic block happens to be allocated at
address where an already deleted block was and we don't explicitly set
block frequency for that new block, BFI will report some non-default
frequency for the block even though frequency for the block was never
set. Inliner is an example of a transformation that adds and removes BBs
while querying and updating BFI.
With this patch, thanks to updates via CallbackVH, BFI won't keep stale
pointers in its Nodes map.

Reviewers: davidxl, yamauchi, asbirlea, fhahn, fedor.sergeev

Reviewed-By: asbirlea, davidxl

Tags: #llvm

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




More information about the All-commits mailing list