]> granicus.if.org Git - llvm/commit
[MemorySSA] Cleanup trivial phis.
authorAlina Sbirlea <asbirlea@google.com>
Wed, 19 Jun 2019 21:33:09 +0000 (21:33 +0000)
committerAlina Sbirlea <asbirlea@google.com>
Wed, 19 Jun 2019 21:33:09 +0000 (21:33 +0000)
commit2081dbcd9b11860c1c7158b639a66b7af48fd4f0
treec11deb237578735356df1ef5e15740c17c1f02ad
parent074585884ab67165e1d1cf890b6b90b5dd26d4e2
[MemorySSA] Cleanup trivial phis.

Summary:
This is unfortunately needed for correctness, if we are to extend the tolerance of the update API to the way simple loop unswitch is doing cloning.

In simple loop unswitch (as opposed to loop unswitch), not all blocks are cloned. This can create unreachable cloned blocks (no predecessor), which are later cleaned up.

In MemorySSA, the  APIs for supporting these kind of updates (clone + update exit blocks), make certain assumption on the integrity of the CFG. When cloning, if something was not cloned, it's values in MemorySSA default to LiveOnEntry. When updating exit blocks, it is safe to assume that we can first insert phis in the blocks merging two clones, then add additional phis in the IDF of the blocks that received phis. This no longer holds true if one of the clones being merged comes from an unreachable block. We'd conservatively need to add all phis before filling in their incoming definitions. In practice this restriction can be relaxed if we clean up trivial phis after the first round of insertion.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363880 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/MemorySSAUpdater.cpp
test/Analysis/MemorySSA/simple_loop_unswitch_nontrivial.ll [new file with mode: 0644]