[VectorCombine] Switch to using a worklist.
authorFlorian Hahn <flo@fhahn.com>
Wed, 22 Sep 2021 08:30:53 +0000 (09:30 +0100)
committerFlorian Hahn <flo@fhahn.com>
Wed, 22 Sep 2021 08:54:58 +0000 (09:54 +0100)
commit300870a95c22fde840862cf57d82adba3e5bd633
tree2c068e2b4e7e5cd31356e4c7a60ceb8f1574828d
parentab3607c0ed92a7e39952ce22e72e778d2679876a
[VectorCombine] Switch to using a worklist.

This patch updates VectorCombine to use a worklist to allow iterative
simplifications where a combine enables other combines.

Suggested in D100302.

The main use case at the moment is foldSingleElementStore and
scalarizeLoadExtract working together to improve scalarization.

Note that we now also do not run SimplifyInstructionsInBlock on the
whole function if there have been changes. This means we fail to
remove/simplify instructions not related to any of the vector combines.
IMO this is fine, as simplifying the whole function seems more like a
workaround for not tracking the changed instructions.

Compile-time impact looks neutral:
NewPM-O3: +0.02%
NewPM-ReleaseThinLTO: -0.00%
NewPM-ReleaseLTO-g: -0.02%

http://llvm-compile-time-tracker.com/compare.php?from=52832cd917af00e2b9c6a9d1476ba79754dcabff&to=e66520a4637290550a945d528e3e59573485dd40&stat=instructions

Reviewed By: spatel, lebedev.ri

Differential Revision: https://reviews.llvm.org/D110171
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/PhaseOrdering/AArch64/matrix-extract-insert.ll
llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
llvm/test/Transforms/VectorCombine/X86/extract-binop-inseltpoison.ll
llvm/test/Transforms/VectorCombine/X86/extract-binop.ll
llvm/test/Transforms/VectorCombine/load-insert-store.ll