1. [VectorCombine] new IR transform pass for partial vector ops (details)
Commit a17f03bd93939cf30bfbb829321437bd0aaa4ef0 by spatel
[VectorCombine] new IR transform pass for partial vector ops
We have several bug reports that could be characterized as "reducing
scalarization", and this topic was also raised on llvm-dev recently: I'm proposing that we deal with these patterns in a new,
lightweight IR vector pass that runs before/after other vectorization
There are 4 alternate options that I can think of to deal with this kind
of problem
(and we've seen various attempts at all of these), but they all have
    InstCombine - can't happen without TTI, but we don't want
                 folds there.
   SDAG - too late to assist other vectorization passes; TLI is not
          for these kind of cost queries; limited to a single basic
   CGP - too late to assist other vectorization passes; would need to
         basic cleanups like CSE/instcombine.
   SLP - doesn't fit with existing transforms; limited to a single basic
This initial patch/transform is based on existing code in
AggressiveInstCombine: we walk backwards through the function looking
for a pattern match. But we diverge from that cost-independent IR
canonicalization pass by using TTI to decide if the vector alternative
is profitable.
We probably have at least 10 similar bug reports/patterns (binops,
constants, inserts, cheap shuffles, etc) that would fit in this pass as
follow-up enhancements. It's possible that we could iterate on a
worklist to fix-point like InstCombine does, but it's safer to start
with a most basic case and evolve from there, so I didn't try to do
anything fancy with this initial implementation.
Differential Revision:
The file was modifiedllvm/test/Other/new-pm-thinlto-defaults.ll (diff)
The file was modifiedllvm/test/Other/new-pm-defaults.ll (diff)
The file was addedllvm/lib/Transforms/Vectorize/VectorCombine.cpp
The file was modifiedllvm/include/llvm/InitializePasses.h (diff)
The file was modifiedllvm/test/Other/opt-O3-pipeline.ll (diff)
The file was modifiedllvm/test/Other/opt-O2-pipeline.ll (diff)
The file was modifiedllvm/include/llvm/Transforms/Vectorize.h (diff)
The file was addedllvm/test/Transforms/VectorCombine/X86/extract-cmp.ll
The file was modifiedllvm/include/llvm/LinkAllPasses.h (diff)
The file was modifiedllvm/lib/Transforms/Vectorize/Vectorize.cpp (diff)
The file was addedllvm/include/llvm/Transforms/Vectorize/VectorCombine.h
The file was modifiedllvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll (diff)
The file was modifiedllvm/lib/Passes/PassBuilder.cpp (diff)
The file was modifiedllvm/test/Other/opt-Os-pipeline.ll (diff)
The file was modifiedllvm/lib/Transforms/Vectorize/CMakeLists.txt (diff)
The file was modifiedllvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll (diff)
The file was modifiedllvm/lib/Passes/PassRegistry.def (diff)
The file was addedllvm/test/Transforms/VectorCombine/X86/lit.local.cfg
The file was modifiedllvm/lib/Transforms/IPO/PassManagerBuilder.cpp (diff)