This is an archive of the discontinued LLVM Phabricator instance.

[MemorySSA] Add API to update an incoming block into a MemoryPhi.
AbandonedPublic

Authored by asbirlea on Aug 13 2018, 10:44 AM.

Details

Summary

Add an API to update the incoming block into a MemoryPhi when a block predecessors changes.
The use case is when splitting blocks. This patch unblocks D45300.

Diff Detail

Event Timeline

asbirlea created this revision.Aug 13 2018, 10:44 AM

This can actually be done with the more generic wireOldPredecessorsToNewImmediatePredecessor.
There's some extra work in the generic one with creating a new phi and then deleting it, but it may be better than having another API.
George, let me know if you agree with using the generic one and I'll abandon this revision. Thanks!

George, let me know if you agree with using the generic one and I'll abandon this revision. Thanks!

Unless profiling shows that it makes a difference, I'm in favor of using the generic impl for simplicity/code reuse, too.

Thanks for the patch!

include/llvm/Analysis/MemorySSAUpdater.h
127

(If we do drop the new API, do the users of replacePhiIncomingBlock guarantee that ReplaceWith is empty? I assume so, but if not, might want to rephrase this -- feel free to do so with post-commit review :) )

asbirlea abandoned this revision.Aug 14 2018, 9:54 AM
asbirlea marked an inline comment as done.

Ack, using the generic one. I can revisit this if, once used, profiling shows a significant difference.

include/llvm/Analysis/MemorySSAUpdater.h
127

Yes, ReplaceWith is empty.