[GVN] Preserve loop related analysis/canonical forms.
authorFlorian Hahn <flo@fhahn.com>
Tue, 30 Jul 2019 16:43:39 +0000 (16:43 +0000)
committerFlorian Hahn <flo@fhahn.com>
Tue, 30 Jul 2019 16:43:39 +0000 (16:43 +0000)
commit2d7227ec3ac91f36fc32b1c21e72e2f1f5d030ad
treee8deccc84424c6eb671939bf98e98164302af0ce
parentd3ae0bc31043bdd544485f060dbc1bf79a4aa5f9
[GVN] Preserve loop related analysis/canonical forms.

LoopInfo can be easily preserved by passing it to the functions that
modify the CFG (SplitCriticalEdge and MergeBlockIntoPredecessor.
SplitCriticalEdge also preserves LoopSimplify and LCSSA form when when passing in
LoopInfo. The test case shows that we preserve LoopSimplify and
LoopInfo. Adding addPreservedID(LCSSAID) did not preserve LCSSA for some
reason.

Also I am not sure if it is possible to preserve those in the new pass
manager, as they aren't analysis passes.

Reviewers: reames, hfinkel, davide, jdoerfert

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D65137

llvm-svn: 367332
llvm/include/llvm/Analysis/CFG.h
llvm/include/llvm/Transforms/Scalar/GVN.h
llvm/lib/Analysis/CFG.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/PRE/2011-06-01-NonLocalMemdepMiscompile.ll
llvm/test/Transforms/GVN/preserve-analysis.ll [new file with mode: 0644]