[all-commits] [llvm/llvm-project] 2ea4c2: [BFI] Make BFI information available through loop ...

WenleiHe via All-commits all-commits at lists.llvm.org
Tue Sep 15 16:16:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ea4c2c598b7c6f95b5d4db747bdf72770e586df
      https://github.com/llvm/llvm-project/commit/2ea4c2c598b7c6f95b5d4db747bdf72770e586df
  Author: Wenlei He <aktoon at gmail.com>
  Date:   2020-09-15 (Tue, 15 Sep 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/LoopAnalysisManager.h
    M llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/lib/Transforms/Scalar/LoopDistribute.cpp
    M llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
    M llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
    M llvm/lib/Transforms/Utils/LoopVersioning.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Other/opt-O2-pipeline.ll
    M llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
    M llvm/test/Other/opt-O3-pipeline.ll
    M llvm/test/Other/opt-Os-pipeline.ll
    M llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp

  Log Message:
  -----------
  [BFI] Make BFI information available through loop passes inside LoopStandardAnalysisResults

~~D65060 uncovered that trying to use BFI in loop passes can lead to non-deterministic behavior when blocks are re-used while retaining old BFI data.~~

~~To make sure BFI is preserved through loop passes a Value Handle (VH) callback is registered on blocks themselves. When a block is freed it now also wipes out the accompanying BFI entry such that stale BFI data can no longer persist resolving the determinism issue. ~~

~~An optimistic approach would be to incrementally update BFI information throughout the loop passes rather than only invalidating them on removed blocks. The issues with that are:~~
~~1. It is not clear how BFI information should be incrementally updated: If a block is duplicated does its BFI information come with? How about if it's split/modified/moved around? ~~
~~2. Assuming we can address these problems the implementation here will be a massive undertaking. ~~

~~There's a known need of BFI in LICM analysis which requires correct but not incrementally updated BFI data. A follow-up change can register BFI in all loop passes so this preserved but potentially lossy data is available to any loop pass that wants it.~~

See: D75341 for an identical implementation of preserving BFI via VH callbacks. The previous statements do still apply but this change no longer has to be in this diff because it's already upstream 😄 .

This diff also moves BFI to be a part of LoopStandardAnalysisResults since the previous method using getCachedResults now (correctly!) statically asserts (D72893) that this data isn't static through the loop passes.

Testing
Ninja check

Reviewed By: asbirlea, nikic

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




More information about the All-commits mailing list