[all-commits] [llvm/llvm-project] 0ea374: [LV] Set up branch from middle block earlier.
Florian Hahn via All-commits
all-commits at lists.llvm.org
Sun Dec 27 10:21:54 PST 2020
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0ea3749b3cde16d70c5f66357b623c8edf521f2b
https://github.com/llvm/llvm-project/commit/0ea3749b3cde16d70c5f66357b623c8edf521f2b
Author: Florian Hahn <flo at fhahn.com>
Date: 2020-12-27 (Sun, 27 Dec 2020)
Changed paths:
M llvm/lib/Transforms/Utils/LoopVersioning.cpp
M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
M llvm/test/Transforms/LoopVectorize/SystemZ/predicated-first-order-recurrence.ll
M llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
A llvm/test/Transforms/LoopVectorize/skeleton-lcssa-crash.ll
Log Message:
-----------
[LV] Set up branch from middle block earlier.
Previously the branch from the middle block to the scalar preheader & exit
was being set-up at the end of skeleton creation in completeLoopSkeleton.
Inserting SCEV or runtime checks may result in LCSSA phis being created,
if they are required. Adjusting branches afterwards may break those
PHIs.
To avoid this, we can instead create the branch from the middle block
to the exit after we created the middle block, so we have the final CFG
before potentially adjusting/creating PHIs.
This fixes a crash for the included test case. For the non-crashing
case, this is almost a NFC with respect to the generated code. The
only change is the order of the predecessors of the involved branch
targets.
Note an assertion was moved from LoopVersioning() to
LoopVersioning::versionLoop. Adjusting the branches means loop-simplify
form may be broken before constructing LoopVersioning. But LV only uses
LoopVersioning to annotate the loop instructions with !noalias metadata,
which does not require loop-simplify form.
This is a fix for an existing issue uncovered by D93317.
More information about the All-commits
mailing list