[BlockExtractor] Extend the file format to support the grouping of basic blocks
authorQuentin Colombet <quentin.colombet@gmail.com>
Thu, 18 Apr 2019 18:28:30 +0000 (18:28 +0000)
committerQuentin Colombet <quentin.colombet@gmail.com>
Thu, 18 Apr 2019 18:28:30 +0000 (18:28 +0000)
commitea3364bf85ef72001b8db3c6fd2dc34f9311b111
treeea4301374c3d332b945902be4be4a074b895b24d
parentdcf4b9aee06a0fe8aed9b2b86a24761cb23e2c10
[BlockExtractor] Extend the file format to support the grouping of basic blocks

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 comma separated list of basic blocks
to form group.

When the region formed by a group 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[,bbName...]
   foo      bb1        ;; Extract bb1 in its own function
   foo      bb2,bb3    ;; Extract bb2,bb3 in their own function
   bar      bb1,bb4    ;; Extract bb1,bb4 in their own function
   bar      bb2        ;; Extract bb2 in its own function

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

Differential Revision: https://reviews.llvm.org/D60746

llvm-svn: 358701
llvm/lib/Transforms/IPO/BlockExtractor.cpp
llvm/test/Transforms/BlockExtractor/extract-blocks-with-groups.ll [new file with mode: 0644]