[SCEVExpander] Add helper to clean up instrs inserted while expanding.
authorFlorian Hahn <flo@fhahn.com>
Tue, 11 Aug 2020 08:30:31 +0000 (09:30 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 11 Aug 2020 08:30:31 +0000 (09:30 +0100)
commit7829c33084a7a5097533cf862daef521380c4e63
treefb9a25e38fefbca2c27cc307ab4dad2e3286fad9
parent31fd64ac57a2005c0691b8870e28b4421cf67047
[SCEVExpander] Add helper to clean up instrs inserted while expanding.

SCEVExpander already tracks which instructions have been inserted n
InsertedValues/InsertedPostIncValues. This patch adds an additional
vector to collect the instructions in insertion order. This can then be
used to remove exactly the instructions inserted by the expander.

This replaces ExpandedValuesCleaner, which in some cases might remove
values not inserted by the expander (e.g. if a value was dead before
insertion and is then used during expansion).

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D84327
llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp