[all-commits] [llvm/llvm-project] 6782d7: [LoopPassManager] Ensure to construct loop nests w...

CongzheUalberta via All-commits all-commits at lists.llvm.org
Wed Sep 21 21:00:35 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6782d71680ea1cbddd7a98f176e2d9b5b78536d8
      https://github.com/llvm/llvm-project/commit/6782d71680ea1cbddd7a98f176e2d9b5b78536d8
  Author: Congzhe Cao <congzhe.cao at huawei.com>
  Date:   2022-09-21 (Wed, 21 Sep 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
    M llvm/lib/Transforms/Scalar/LoopInterchange.cpp
    M llvm/lib/Transforms/Scalar/LoopPassManager.cpp
    A llvm/test/Transforms/LoopInterchange/interchanged-loop-nest-4.ll

  Log Message:
  -----------
  [LoopPassManager] Ensure to construct loop nests with the outermost loop

This patch is to resolve the bug reported and discussed in
https://reviews.llvm.org/D124926#3718761 and https://reviews.llvm.org/D124926#3719876.

The problem is that loop interchange is a loopnest pass under the new pass manager,
but the loop nest may not be constructed correctly by the loop pass manager after
running loop interchange and before running the next pass, which might cause problems
when it continues running the next pass.

The reason that the loop nest is constructed incorrectly is that the outermost
loop might have changed after interchange, and what was the original outermost
loop is not the current outermost loop anymore. Constructing the loop nest based
on the original outermost loop would generate an invalid loop nest.

The fix in this patch is that, in the loop pass manager before running each loopnest
pass, we re-cosntruct the loop nest based on the current outermost loop, if LPMUpdater
notifies the loop pass manager that the previous loop nest has been invalidated by passes
like loop interchange.

Reviewed By: aeubanks

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




More information about the All-commits mailing list