[all-commits] [llvm/llvm-project] fa1632: [NFC] [LoopPeel] Change the way DT is updated for ...
Max Kazantsev via All-commits
all-commits at lists.llvm.org
Sun Oct 17 20:53:13 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fa16329ae0721023376f24c7577b9020d438df1a
https://github.com/llvm/llvm-project/commit/fa16329ae0721023376f24c7577b9020d438df1a
Author: Max Kazantsev <mkazantsev at azul.com>
Date: 2021-10-18 (Mon, 18 Oct 2021)
Changed paths:
M llvm/lib/Transforms/Utils/LoopPeel.cpp
Log Message:
-----------
[NFC] [LoopPeel] Change the way DT is updated for loop exits
When peeling a loop, we assume that the latch has a `br` terminator and
that all loop exits are either terminated with an `unreachable` or have
a terminating deoptimize call. So when we peel off the 1st iteration, we
change the IDom of all loop exits to the peeled copy of
`NCD(IDom(Exit), Latch)`. This works now, but if we add logic to support
loops with exits that are followed by a block with an `unreachable` or a
terminating deoptimize call, changing the exit's idom wouldn't be enough
and DT would be broken.
For example, let `Exit1` and `Exit2` are loop exits, and each of them
unconditionally branches to the same `unreachable` terminated block. So
neither of the exits dominates this unreachable block. If we change the
IDoms of the exits to some peeled loop block, we don't update the
dominators of the unreachable block. Currently we just don't get to the
peeling logic, saying that we can't peel such loops.
With this NFC we just insert edges from cloned exiting blocks to their
exits after peeling each iteration (we accumulate the insertion updates
and then after peeling apply the updates to DT).
This patch was a part of D110922.
Patch by Dmitry Makogon!
Differential Revision: https://reviews.llvm.org/D111611
Reviewed By: mkazantsev
More information about the All-commits
mailing list