[PATCH] D58652: [MemorySSA] Make insertDef insert corresponding phi nodes.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 25 16:24:56 PST 2019


asbirlea created this revision.
asbirlea added a reviewer: george.burgess.iv.
Herald added subscribers: jdoerfert, Prazek, jlebar, sanjoy.
Herald added a project: LLVM.

The original assumption for the insertDef method was that it would not
materialize Defs out of no-where, hence it will not insert phis needed
after inserting a Def.

However, when cloning an instruction (use case used in LICM), we do
materialize Defs "out of no-where". If the block receiving a Def has at
least one other Def, then no processing is needed. If the block just
received its first Def, we must check where Phi placement is needed.
The only new usage of insertDef is in LICM, hence the trigger for the bug.

But the original goal of the method also fails to apply for the move()
method. If we move a Def from the entry point of a diamond to either the
left or right blocks, then the merge block must add a phi.
While this usecase does not currently occur, or may be viewed as an
incorrect transformation, MSSA must behave corectly given the scenario.

Resolves PR40749 and PR40754.


Repository:
  rL LLVM

https://reviews.llvm.org/D58652

Files:
  lib/Analysis/MemorySSAUpdater.cpp
  lib/Transforms/Scalar/LICM.cpp
  test/Analysis/MemorySSA/pr40749.ll
  test/Analysis/MemorySSA/pr40754.ll
  unittests/Analysis/MemorySSATest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58652.188272.patch
Type: text/x-patch
Size: 9631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190226/126c780f/attachment.bin>


More information about the llvm-commits mailing list