[all-commits] [llvm/llvm-project] 4739dd: [LoopDeletion] Break backedge of outermost loops w...

Philip Reames via All-commits all-commits at lists.llvm.org
Sun Jan 10 16:07:31 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4739dd67e7a08b715f1d23f71fb4af16007fe80a
      https://github.com/llvm/llvm-project/commit/4739dd67e7a08b715f1d23f71fb4af16007fe80a
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-01-10 (Sun, 10 Jan 2021)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/LoopUtils.h
    M llvm/lib/Transforms/Scalar/LoopDeletion.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/test/Transforms/IndVarSimplify/exit_value_test2.ll
    M llvm/test/Transforms/LoopDeletion/update-scev.ll
    M llvm/test/Transforms/LoopDeletion/zero-btc.ll

  Log Message:
  -----------
  [LoopDeletion] Break backedge of outermost loops when known not taken

This is a resubmit of dd6bb367 (which was reverted due to stage2 build failures in 7c63aac), with the additional restriction added to the transform to only consider outer most loops.

As shown in the added test case, ensuring LCSSA is up to date when deleting an inner loop is tricky as we may actually need to remove blocks from any outer loops, thus changing the exit block set.   For the moment, just avoid transforming this case.  I plan to return to this case in a follow up patch and see if we can do better.

Original commit message follows...

The basic idea is that if SCEV can prove the backedge isn't taken, we can go ahead and get rid of the backedge (and thus the loop) while leaving the rest of the control in place. This nicely handles cases with dispatch between multiple exits and internal side effects.

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




More information about the All-commits mailing list