[PATCH] D60746: [BlockExtractor] Extend the file format to support the grouping of basic blocks

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 19:06:44 PDT 2019


qcolombet created this revision.
qcolombet added a reviewer: volkan.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Prior to this patch, each basic block listed in the extrack-blocks-file
would be extracted to a different function.

This patch adds the support for an optional "group" column.
This column is a string representing the group ID. All the basic blocks
with the same parent function and the same group ID will be extracted
together; assuming the region they represent is extractable.
No group ID means the basic block will be extracted in its own function,
i.e., the default behavior remains unchanged.

When the region formed by a group ID is not extractable, e.g., not single
entry, all the blocks of that group are left untouched.

Let us see this new format in action (comments are not part of the
file format):
;; funcName bbName [groupID]
foo      bb1        ;; Extract bb1 in its own function
foo      bb2    1   ;; Extract bb2 with bbs from group <foo, 1>
foo      bb3    1   ;; Extract bb3 with bbs from group <foo, 1>
bar      bb1    1   ;; Extract bb1 with bbs from group <bar, 1>
bar      bb2        ;; Extract bb2 in its own function
bar      bb3    2   ;; Extract bb3 with bbs in group <bar, 2>
bar      bb4    1   ;; Extract bb4 with bbs from group <bar, 1>

This describes 5 regions to extract:

- <foo, bb1> = bb1
- <foo, 1> = bb2, bb3
- <bar, 1> = bb1, bb4
- <bar, 2> = bb3
- <bar, bb2> = bb2

Assuming all regions are extractable, this will create one function and
thus one call per region.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60746

Files:
  llvm/lib/Transforms/IPO/BlockExtractor.cpp
  llvm/test/Transforms/BlockExtractor/extract-blocks-with-groups.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60746.195289.patch
Type: text/x-patch
Size: 10488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/73093ee1/attachment.bin>


More information about the llvm-commits mailing list