This is an archive of the discontinued LLVM Phabricator instance.

[IROutliner] Fix miscounting of exit paths when a single phi node used as an output for several outlined regions.
ClosedPublic

Authored by AndrewLitteken on Mar 9 2022, 11:00 AM.

Details

Summary

Reproduced: https://godbolt.org/z/j9sK47KM7

The IR Outliner is supposed to extract the outputs contained in an external phi node and place them into a phi node contained within the outlined function. However, when the output values of two outlined functions with two different output sets are contained within the same phi node, they are counted as the same exit path when first analyzed. In reality, these create two different phi nodes, creating an inconsistency, resulting in a mismatch in the expected number of output paths and a crash.

Diff Detail

Event Timeline

AndrewLitteken created this revision.Mar 9 2022, 11:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 11:00 AM
AndrewLitteken requested review of this revision.Mar 9 2022, 11:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 11:00 AM
paquette accepted this revision.Mar 9 2022, 11:19 AM
paquette added inline comments.
llvm/lib/Transforms/IPO/IROutliner.cpp
1120

We ignore this case for now, and so ignore the region

Should this be a TODO?

This revision is now accepted and ready to land.Mar 9 2022, 11:19 AM
AndrewLitteken added inline comments.Mar 9 2022, 11:21 AM
llvm/lib/Transforms/IPO/IROutliner.cpp
1120

Yes, probably. I'll add a note before I push it.

This revision was landed with ongoing or failed builds.Mar 14 2022, 12:57 PM
This revision was automatically updated to reflect the committed changes.