[all-commits] [llvm/llvm-project] dcc3e7: [IROutliner] Allowing Phi Nodes in exit blocks

Andrew Litteken via All-commits all-commits at lists.llvm.org
Tue Jan 25 09:34:29 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dcc3e728ca018de785991d4ecb9efe4f6a18ca75
      https://github.com/llvm/llvm-project/commit/dcc3e728ca018de785991d4ecb9efe4f6a18ca75
  Author: Andrew Litteken <andrew.litteken at gmail.com>
  Date:   2022-01-25 (Tue, 25 Jan 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/IROutliner.h
    M llvm/lib/Transforms/IPO/IROutliner.cpp
    A llvm/test/Transforms/IROutliner/gvn-output-set-overload.ll
    A llvm/test/Transforms/IROutliner/mismatched-phi-exits-not-in-first-outlined.ll
    A llvm/test/Transforms/IROutliner/mismatched-phi-exits.ll
    A llvm/test/Transforms/IROutliner/mismatched-phi-outputs-ordering.ll
    A llvm/test/Transforms/IROutliner/outlining-branches-phi-nodes.ll
    M llvm/test/Transforms/IROutliner/outlining-exits-to-phi-node.ll
    A llvm/test/Transforms/IROutliner/phi-nodes-output-overload.ll
    A llvm/test/Transforms/IROutliner/region-inputs-in-phi-nodes.ll

  Log Message:
  -----------
  [IROutliner] Allowing Phi Nodes in exit blocks

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.

Reviewers: paquette

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




More information about the All-commits mailing list