This is an archive of the discontinued LLVM Phabricator instance.

[IRSim][IROutliner] Adding support for elevating constants that are not the same in each region to arguments

Authored by AndrewLitteken on Sep 8 2020, 9:53 AM.



When there are constants that have the same structural location, but not the same value, between different regions, we cannot simply outline the region. Instead, we find the constants that are not the same in each location, and promote them to arguments to be passed into the respective functions. At each call site, we pass the constant in as an argument regardless of type.

Added/Edited Tests:

  • llvm/test/Transforms/IROutliner/outlining-constants-vs-registers.ll
  • llvm/test/Transforms/IROutliner/outlining-different-constants.ll
  • llvm/test/Transforms/IROutliner/outlining-different-globals.ll

Diff Detail

Event Timeline

AndrewLitteken created this revision.Sep 8 2020, 9:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2020, 9:53 AM
jroelofs added inline comments.


might be a better name?


I'd expect an RAUW... what if the call returns something?

AndrewLitteken added inline comments.Sep 15 2020, 4:15 PM

The constructed functions do not return anything based on the CodeExtractor as they only contain single blocks. Additionally, this function only exists once since the extraction of a region only results in one function.

After extraction we replace the different calls with a call to the aggregate function we created.

jroelofs added inline comments.Sep 15 2020, 4:30 PM

Oh, I see. This is only acting on synthesized calls, not pre-existing ones.

Updating comments.

This revision is now accepted and ready to land.Sep 16 2020, 8:46 AM

Updating to reflect other patches.