[PATCH] D106995: [IROutliner] Allowing PHINodes in Exit Blocks

Andrew Litteken via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 28 13:09:49 PDT 2021


AndrewLitteken created this revision.
AndrewLitteken added a reviewer: paquette.
Herald added subscribers: ormris, hiraditya.
AndrewLitteken requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In addition to having multiple exit locations, there can be multiple blocks leading to the same exit location, which results in a potential phi node.  If we find that multiple blocks within the region branch to the same block outside the region, resulting in a phi node, the code extractor pulls this phi node into the function and uses it as an output.

We make sure that this phi node is given an output slot, and that the two values are removed from the outputs if they are not used anywhere else outside of the region.  Across the extracted regions, the phi nodes are combined into a single block for each potential output block, similar to the previous patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106995

Files:
  llvm/include/llvm/Transforms/IPO/IROutliner.h
  llvm/lib/Transforms/IPO/IROutliner.cpp
  llvm/test/Transforms/IROutliner/outlining-branches-phi-nodes.ll
  llvm/test/Transforms/IROutliner/outlining-multiple-exits-diff-outputs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106995.362507.patch
Type: text/x-patch
Size: 27050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210728/d938d5fe/attachment.bin>


More information about the llvm-commits mailing list