summaryrefslogtreecommitdiffstats
path: root/polly/lib/Support/ScopHelper.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-10-09 23:40:24 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-10-09 23:40:24 +0000
commitf363ed9804e72982b673ff36ef1f1450a1774ba1 (patch)
tree2db8ed5c589dafd3e09d62cc14c8337aa55e7b4d /polly/lib/Support/ScopHelper.cpp
parent14e773500e036de57ed0ca4af6fddc1f8b6767d8 (diff)
downloadbcm5719-llvm-f363ed9804e72982b673ff36ef1f1450a1774ba1.tar.gz
bcm5719-llvm-f363ed9804e72982b673ff36ef1f1450a1774ba1.zip
[NFC] Move helper functions to ScopHelper
Helper functions in the BlockGenerators.h/cpp introduce dependences from the frontend to the backend of Polly. As they are used in ScopDetection, ScopInfo, etc. we move them to the ScopHelper file. llvm-svn: 249919
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r--polly/lib/Support/ScopHelper.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp
index 022f427ecc8..b17ffdc91a4 100644
--- a/polly/lib/Support/ScopHelper.cpp
+++ b/polly/lib/Support/ScopHelper.cpp
@@ -14,12 +14,14 @@
#include "polly/Support/ScopHelper.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
+#include "polly/Support/SCEVValidator.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/IR/CFG.h"
+#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -401,3 +403,43 @@ bool polly::isHoistableLoad(LoadInst *LInst, Region &R, LoopInfo &LI,
return true;
}
+
+bool polly::isIgnoredIntrinsic(const Value *V) {
+ if (auto *IT = dyn_cast<IntrinsicInst>(V)) {
+ switch (IT->getIntrinsicID()) {
+ // Lifetime markers are supported/ignored.
+ case llvm::Intrinsic::lifetime_start:
+ case llvm::Intrinsic::lifetime_end:
+ // Invariant markers are supported/ignored.
+ case llvm::Intrinsic::invariant_start:
+ case llvm::Intrinsic::invariant_end:
+ // Some misc annotations are supported/ignored.
+ case llvm::Intrinsic::var_annotation:
+ case llvm::Intrinsic::ptr_annotation:
+ case llvm::Intrinsic::annotation:
+ case llvm::Intrinsic::donothing:
+ case llvm::Intrinsic::assume:
+ case llvm::Intrinsic::expect:
+ // Some debug info intrisics are supported/ignored.
+ case llvm::Intrinsic::dbg_value:
+ case llvm::Intrinsic::dbg_declare:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
+bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI,
+ ScalarEvolution *SE, const Region *R) {
+ if (!V || !SE->isSCEVable(V->getType()))
+ return false;
+
+ if (const SCEV *Scev = SE->getSCEV(const_cast<Value *>(V)))
+ if (!isa<SCEVCouldNotCompute>(Scev))
+ if (!hasScalarDepsInsideRegion(Scev, R))
+ return true;
+
+ return false;
+}
OpenPOWER on IntegriCloud