]> granicus.if.org Git - llvm/commit
[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.
authorAlina Sbirlea <asbirlea@google.com>
Wed, 25 Sep 2019 23:24:39 +0000 (23:24 +0000)
committerAlina Sbirlea <asbirlea@google.com>
Wed, 25 Sep 2019 23:24:39 +0000 (23:24 +0000)
commit88de695493c8df761fe83e49b6059914ed39b2c1
tree34d8e5975d572f39e9fd4f76f7bc5abd45ae2b72
parent810c818288fac9763ab4812d32b93905f37e2240
[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.

Summary:
If a block has all incoming values with the same MemoryAccess (ignoring
incoming values from unreachable blocks), then use that incoming
MemoryAccess and do not create a Phi in the first place.

Revert IDF work-around added in rL372673; it should not be required unless
the Def inserted is the first in its block.

The patch also cleans up a series of tests, added during the many
iterations on insertDef.

The patch also fixes PR43438.
The same issue that occurs in insertDef with "adding phis, hence the IDF of
Phis is needed", can also occur in fixupDefs: the `getPreviousRecursive`
call only adds Phis walking on the predecessor edges, which means there
may be the case of a Phi added walking the CFG "backwards" which
triggers the needs for an additional Phi in successor blocks.
Such Phis are added during fixupDefs only in the presence of unreachable
blocks.
Hence this highlights the need to avoid adding Phis in blocks with
unreachable predecessors in the first place.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372932 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/MemorySSAUpdater.cpp
test/Analysis/MemorySSA/pr40754.ll
test/Analysis/MemorySSA/pr41640.ll
test/Analysis/MemorySSA/pr42940.ll [moved from test/Analysis/MemorySSA/PR42940.ll with 100% similarity]
test/Analysis/MemorySSA/pr43044.ll [moved from test/Analysis/MemorySSA/PR43044.ll with 100% similarity]
test/Analysis/MemorySSA/pr43317.ll
test/Analysis/MemorySSA/pr43438.ll [new file with mode: 0644]