[SCEVExpander] Move LCSSA fixup to ::expand.
authorFlorian Hahn <flo@fhahn.com>
Thu, 29 Sep 2022 19:49:55 +0000 (20:49 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 29 Sep 2022 19:49:56 +0000 (20:49 +0100)
commit9933a2e9fd0c37dcdce5952fab7e486d3cf2d336
treee4e9d9112b1f2b3806223649f6fdd44a43e9b389
parent0513b0305acde91a0a5f7f5ea4061476011f0d1d
[SCEVExpander] Move LCSSA fixup to ::expand.

Move LCSSA fixup from ::expandCodeForImpl to ::expand(). This has
the advantage that we directly preserve LCSSA nodes here instead of
relying on doing so in rememberInstruction. It also ensures that we
 don't add the non-LCSSA-safe value to InsertedExpressions.

Alternative to D132704.

Fixes #57000.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D134739
llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
llvm/test/Transforms/LoopVectorize/skeleton-lcssa-crash.ll