[VPlan] Create header & latch blocks for skeleton up front (NFC).
authorFlorian Hahn <flo@fhahn.com>
Wed, 22 Dec 2021 12:44:24 +0000 (12:44 +0000)
committerFlorian Hahn <flo@fhahn.com>
Wed, 22 Dec 2021 12:44:25 +0000 (12:44 +0000)
commitede7c2438f39e8901a6479f180255ad0f5f36d32
tree7906ead1c03f70972a36e474a0c2438dbf5613f2
parentc83ef407dfa1b6b96c3068512edb479e2b33fc7f
[VPlan] Create header & latch blocks for skeleton up front (NFC).

By creating the header and latch blocks up front and adding blocks and
recipes in between those 2 blocks we ensure that the entry and exits of
the plan remain valid throughout construction.

In order to avoid test changes and keep printing of the plans the same,
we use the new header block instead of creating a new block on the first
iteration of the loop traversing the original loop.

We also fold the latch into its predecessor.

This is a follow up to a post-commit suggestion in D114586.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D115793
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/test/Transforms/LoopVectorize/reduction-order.ll
llvm/test/Transforms/LoopVectorize/select-reduction.ll