Page MenuHomePhabricator

[IRSim][IROutliner] Merging output blocks for extracted functions with outputs
AcceptedPublic

Authored by AndrewLitteken on Sep 8 2020, 10:14 AM.

Details

Reviewers
paquette
jroelofs
Summary

Many of the sets of output stores will be the same. When a block is created, we check if there is an output block with the same set of store instructions. If there is, we map the output block of the region back to the block, so that the extra argument controlling the switch statement can be set to the appropriate block value.

Test:

  • llvm/test/Transforms/IROutliner/outlining-same-output-blocks.ll

Diff Detail

Event Timeline

AndrewLitteken created this revision.Sep 8 2020, 10:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2020, 10:14 AM
jroelofs added inline comments.
llvm/lib/Transforms/IPO/IROutliner.cpp
54

Can you elaborate some more on the comment about DenseMap?

Updating comments for why we are using std::set instead of DenseSets.

Removing std::set usage.

Moving findDuplicateBlock to this diff.

jroelofs added inline comments.Sep 15 2020, 12:13 PM
llvm/lib/Transforms/IPO/IROutliner.cpp
807

s/it the new/it from the new/ ?

Also, since this function is just doing that analysis and not actually doing the removal/addition, the "action" part of this sentence probably belongs near the call site instead.

831

isa<BranchInst>(I), since BI is unused.

950

This call to getValue() comes before the check for hasValue(). Maybe you want this instead:

if (Optional<unsigned> MatchingBB =
      findDuplicateOutputBlock(OutputBB, OutputStoreBBs)) {
  ...

and then sink the debug prints into it.

1010

Updating comments and Optional handling

This revision is now accepted and ready to land.Sep 18 2020, 9:29 AM

Updating based on previous patches.