[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE
authorWei Mi <wmi@google.com>
Tue, 8 Aug 2017 21:40:14 +0000 (21:40 +0000)
committerWei Mi <wmi@google.com>
Tue, 8 Aug 2017 21:40:14 +0000 (21:40 +0000)
commitbb9106ac4b8c3c7bf2c7c12d484c1eea60707b76
treea8fefc7102798053fb6b4886964b8ece3ac3c836
parent598d1632e1f7a60250669160cd4fd3d7886537de
[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE

When a new phi is generated for scalarpre of an expression, the phiTranslate cache
will become stale: Before PRE, the candidate expression must not be available in a
predecessor block, and phitranslate will cache the information. After PRE, the
expression will become available in all predecessor blocks, so the related entries
in phiTranslate cache becomes stale. The patch will simply remove the stale entries
so phiTranslate can be recomputed next time.

The stale entries in phitranslate cache will not affect correctness but will cause
missing PRE opportunity for later instructions.

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

llvm-svn: 310421
llvm/include/llvm/Transforms/Scalar/GVN.h
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/PRE/phi-translate-2.ll