[Polly] Add handling of Top Level Regions
commit6547ff25af2a41e55c18f7d65f566ba3b5a954ca
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Wed, 24 May 2017 18:39:39 +0000 (24 18:39 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Wed, 24 May 2017 18:39:39 +0000 (24 18:39 +0000)
tree897827bf077a99aae4227a065ec1889374359a9d
parentda66e5a2727c72256a6a350921cfdd8db36e26e8
[Polly] Add handling of Top Level Regions

Summary:
My goal is to make the newly added `AllowWholeFunctions` options more usable/powerful.

The changes to ScopBuilder.cpp are exclusively checks to prevent `Region.getExit()` from being dereferenced, since Top Level Regions (TLRs) don't have an exit block.

In ScopDetection's `isValidCFG`, I removed a check that disallowed ReturnInstructions to have return values. This might of course have been intentional, so I would welcome your feedback on this and maybe a small explanation why return values are forbidden. Maybe it can be done but needs more changes elsewhere?

The remaining changes in ScopDetection are simply to consider the AllowWholeFunctions option in more places, i.e. allow TLRs when it is set and once again avoid derefererncing `getExit()` if it doesn't exist.

Finally, in ScopHelper.cpp I extended `polly::isErrorBlock` to handle regions without exit blocks as well: The original check was if a given BasicBlock dominates all predecessors of the exit block. Therefore I do the same for TLRs by regarding all BasicBlocks terminating with a ReturnInst as predecessors of a "virtual" function exit block.

Patch by: Lukas Boehm

Reviewers: philip.pfaffe, grosser, Meinersbur

Reviewed By: grosser

Subscribers: pollydev, llvm-commits, bollu

Tags: #polly

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

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@303790 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScopBuilder.cpp
lib/Analysis/ScopDetection.cpp
lib/Analysis/ScopInfo.cpp
lib/Support/ScopHelper.cpp
test/ScopInfo/full-function.ll