diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-09-28 09:33:22 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-09-28 09:33:22 +0000 |
commit | 9a132f36c3da7d0ec9e3b5ee170ca9d7eaf89fb5 (patch) | |
tree | e09d8dee053fb4a2de26bde04efbc4a13ba83743 /polly/lib/Support/ScopHelper.cpp | |
parent | 3d77768e2a8994a82e9ae7df89c8bf967685f755 (diff) | |
download | bcm5719-llvm-9a132f36c3da7d0ec9e3b5ee170ca9d7eaf89fb5.tar.gz bcm5719-llvm-9a132f36c3da7d0ec9e3b5ee170ca9d7eaf89fb5.zip |
Allow switch instructions in SCoPs
This patch allows switch instructions with affine conditions in the
SCoP. Also switch instructions in non-affine subregions are allowed.
Both did not require much changes to the code, though there was some
refactoring needed to integrate them without code duplication.
In the llvm-test suite the number of profitable SCoPs increased from
135 to 139 but more importantly we can handle more benchmarks and user
inputs without preprocessing.
Differential Revision: http://reviews.llvm.org/D13200
llvm-svn: 248701
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r-- | polly/lib/Support/ScopHelper.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp index 69904f0c241..c55a4749314 100644 --- a/polly/lib/Support/ScopHelper.cpp +++ b/polly/lib/Support/ScopHelper.cpp @@ -345,3 +345,17 @@ bool polly::isErrorBlock(BasicBlock &BB) { return false; } + +Value *polly::getConditionFromTerminator(TerminatorInst *TI) { + if (BranchInst *BR = dyn_cast<BranchInst>(TI)) { + if (BR->isUnconditional()) + return ConstantInt::getTrue(Type::getInt1Ty(TI->getContext())); + + return BR->getCondition(); + } + + if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) + return SI->getCondition(); + + return nullptr; +} |