[IROutliner] Avoid reusing PHINodes that have already been matched when merging outli...
authorAndrew Litteken <andrew.litteken@gmail.com>
Wed, 9 Mar 2022 18:33:33 +0000 (10:33 -0800)
committerAndrew Litteken <andrew.litteken@gmail.com>
Mon, 14 Mar 2022 17:00:01 +0000 (12:00 -0500)
commit3c90812f3b43fae3a4a8f0d0d6ec29824690431b
tree47b9320f3dbe69899f8f010d6bcff5b806ce11f6
parent5fc70e53bf2e61290d30c59fb45b034b03471cc6
[IROutliner] Avoid reusing PHINodes that have already been matched when merging outlined functions' phi node blocks

When there are two external phi nodes for two different outlined regions, when compressing the created phi nodes between the two regions, the matching for the second phi node in the second region matches the first phi node created for the first region rather than the second phi node created for the first region. This adds an extra output path where there should not be one.

The fix is the ignore phi nodes that have already been matched for each region.

Reviewer: paquette

Differential Revision: https://reviews.llvm.org/D121312
llvm/lib/Transforms/IPO/IROutliner.cpp
llvm/test/Transforms/IROutliner/duplicate-merging-phis.ll [new file with mode: 0644]