[all-commits] [llvm/llvm-project] 0f0344: [SimpleLoopUnswitch] Inform pass manager when chil...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Sat Sep 4 08:55:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f0344dd1e3b53387bb396070916e67f4c426da6
      https://github.com/llvm/llvm-project/commit/0f0344dd1e3b53387bb396070916e67f4c426da6
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-09-04 (Sat, 04 Sep 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    A llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-markloopasdeleted.ll

  Log Message:
  -----------
  [SimpleLoopUnswitch] Inform pass manager when child loops are deleted

As part of the nontrivial unswitching we could end up removing child
loops. This patch add a notification to the pass manager when
that happens (using the markLoopAsDeleted callback).

Without this there could be stale LoopAccessAnalysis results cached
in the analysis manager. Those analysis results are cached based on
a Loop* as key. Since the BumpPtrAllocator used to allocate
Loop objects could be resetted between different runs of for
example the loop-distribute pass (running on different functions),
a new Loop object could be created using the same Loop pointer.
And then when requiring the LoopAccessAnalysis for the loop we
got the stale (corrupt) result from the destroyed loop.

Reviewed By: aeubanks

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




More information about the All-commits mailing list