[CodeExtractor] Allow extracting blocks with exception handling
authorSergey Dmitriev <serguei.n.dmitriev@intel.com>
Fri, 11 May 2018 22:49:49 +0000 (22:49 +0000)
committerSergey Dmitriev <serguei.n.dmitriev@intel.com>
Fri, 11 May 2018 22:49:49 +0000 (22:49 +0000)
commit69c9cd277dfa2e1d89c7c09d59ea2d846a98b7e8
treef252c9d6581d513ca22644967ea78e8f148aa9a9
parentc4e4c5b0761b4877e85cf456b5fa42afb7c982a3
[CodeExtractor] Allow extracting blocks with exception handling

This is a CodeExtractor improvement which adds support for extracting blocks
which have exception handling constructs if that is legal to do. CodeExtractor
performs validation checks to ensure that extraction is legal when it finds
invoke instructions or EH pads (landingpad, catchswitch, or cleanuppad) in
blocks to be extracted.

I have also added an option to allow extraction of blocks with alloca
instructions, but no validation is done for allocas. CodeExtractor caller has
to validate it himself before allowing alloca instructions to be extracted.
By default allocas are still not allowed in extraction blocks.

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

llvm-svn: 332151
llvm/include/llvm/Transforms/Utils/CodeExtractor.h
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/test/Transforms/CodeExtractor/inline_eh.ll [new file with mode: 0644]
llvm/test/Transforms/CodeExtractor/inline_eh_1.ll [new file with mode: 0644]