Fold-tail currently supports reduction last-vector-value live-out's,
but has yet to support last-scalar-value live-outs, including
non-header phi's. As it relies on AllowedExit in order to detect
them and bail out we need to add the non-header PHI nodes to
AllowedExit, otherwise we end up with miscompiles.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 37633 Build 37632: arc lint + arc unit
Event Timeline
Please update the comment about AllowedExit in LoopVectorizationLegality. Currently it only states that it holds reduction and induction vars, but it really contains any variable that can be accessed outside the loop.
LGTM, thanks. Please wait with committing a day or so, in case Ayal has additional comments.
This LGTM too; added a couple of minor comments about comments.
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h | ||
---|---|---|
449 | ||
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | ||
779 | While we're at it, the above comment deserves updating as well.. | |
785 | (BTW, this SCEV-predicates condition, related to PR33706, should apply only to IV header-phi's and related instructions. But it's conservative; relaxing it calls for a separate optimization fix.) | |
llvm/test/Transforms/LoopVectorize/lv-fold-tail-by-masking-bug.ll | ||
36 | Please retain the indication that these tests refer to "pr43166". (Such test files are often named pr43166.ll). |
This BTW also includes non-phi instructions, as of rL340278 thanks to @anna. As indicated in a TODO below, perhaps it's better to specify what's not included. For now, perhaps it's better to simply avoid specifying what's included.