[PATCH] D79218: Process gep (phi ptr1, ptr2) in SROA

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 17:30:42 PDT 2020


rampitec updated this revision to Diff 267415.
rampitec added a comment.

Reopening after revert. There were two bugs:

1. PHI can only be recreated in the same BB for incoming block logic to work, so check PHI and GEP are in the same block.
2. That was not right to call visit() from a visitor itself, that resulted in endless loop. Each folding separately (select and PHI) works, but not together. If we have a phi (select) the endless loop happens. Switched to enqueueUsers(). That is also only needed to call it on a newly created PHI or select, as the only users of newly created GEPs are the same PHI or select and the only action expected is enqueueUsers().


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79218/new/

https://reviews.llvm.org/D79218

Files:
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Transforms/SROA/phi-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79218.267415.patch
Type: text/x-patch
Size: 19700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200530/1cbcc986/attachment-0001.bin>


More information about the llvm-commits mailing list