summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-03-23 06:40:15 +0000
committerTobias Grosser <tobias@grosser.es>2016-03-23 06:40:15 +0000
commit898a6362106a0eae64a30e429ddc0492ebc94951 (patch)
tree665e0ce1feabbe39a17fca7b51a522cc33edcb29 /polly/lib/Analysis/ScopDetection.cpp
parent46c8e3a6143c33f32585ce685311f32224b76ed9 (diff)
downloadbcm5719-llvm-898a6362106a0eae64a30e429ddc0492ebc94951.tar.gz
bcm5719-llvm-898a6362106a0eae64a30e429ddc0492ebc94951.zip
Add option to disallow modref function calls in scops.
This might be useful to evaluate the benefit of us handling modref funciton calls. Also, a new bug that was triggered by modref function calls was recently reported http://llvm.org/PR27035. To ensure the same issue does not cause troubles for other people, we temporarily disable this until the bug is resolved. llvm-svn: 264140
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp66
1 files changed, 37 insertions, 29 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 548b8747c20..024f87e6aa6 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -132,6 +132,12 @@ static cl::opt<bool>
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
+static cl::opt<bool>
+ AllowModrefCall("polly-allow-modref-calls",
+ cl::desc("Allow functions with known modref behavior"),
+ cl::Hidden, cl::init(false), cl::ZeroOrMore,
+ cl::cat(PollyCategory));
+
static cl::opt<bool> AllowNonAffineSubRegions(
"polly-allow-nonaffine-branches",
cl::desc("Allow non affine conditions for branches"), cl::Hidden,
@@ -470,39 +476,41 @@ bool ScopDetection::isValidCallInst(CallInst &CI,
if (CalledFunction == 0)
return false;
- switch (AA->getModRefBehavior(CalledFunction)) {
- case llvm::FMRB_UnknownModRefBehavior:
- return false;
- case llvm::FMRB_DoesNotAccessMemory:
- case llvm::FMRB_OnlyReadsMemory:
- // Implicitly disable delinearization since we have an unknown
- // accesses with an unknown access function.
- Context.HasUnknownAccess = true;
- Context.AST.add(&CI);
- return true;
- case llvm::FMRB_OnlyReadsArgumentPointees:
- case llvm::FMRB_OnlyAccessesArgumentPointees:
- for (const auto &Arg : CI.arg_operands()) {
- if (!Arg->getType()->isPointerTy())
- continue;
-
- // Bail if a pointer argument has a base address not known to
- // ScalarEvolution. Note that a zero pointer is acceptable.
- auto *ArgSCEV = SE->getSCEVAtScope(Arg, LI->getLoopFor(CI.getParent()));
- if (ArgSCEV->isZero())
- continue;
-
- auto *BP = dyn_cast<SCEVUnknown>(SE->getPointerBase(ArgSCEV));
- if (!BP)
- return false;
-
+ if (AllowModrefCall) {
+ switch (AA->getModRefBehavior(CalledFunction)) {
+ case llvm::FMRB_UnknownModRefBehavior:
+ return false;
+ case llvm::FMRB_DoesNotAccessMemory:
+ case llvm::FMRB_OnlyReadsMemory:
// Implicitly disable delinearization since we have an unknown
// accesses with an unknown access function.
Context.HasUnknownAccess = true;
- }
+ Context.AST.add(&CI);
+ return true;
+ case llvm::FMRB_OnlyReadsArgumentPointees:
+ case llvm::FMRB_OnlyAccessesArgumentPointees:
+ for (const auto &Arg : CI.arg_operands()) {
+ if (!Arg->getType()->isPointerTy())
+ continue;
+
+ // Bail if a pointer argument has a base address not known to
+ // ScalarEvolution. Note that a zero pointer is acceptable.
+ auto *ArgSCEV = SE->getSCEVAtScope(Arg, LI->getLoopFor(CI.getParent()));
+ if (ArgSCEV->isZero())
+ continue;
+
+ auto *BP = dyn_cast<SCEVUnknown>(SE->getPointerBase(ArgSCEV));
+ if (!BP)
+ return false;
- Context.AST.add(&CI);
- return true;
+ // Implicitly disable delinearization since we have an unknown
+ // accesses with an unknown access function.
+ Context.HasUnknownAccess = true;
+ }
+
+ Context.AST.add(&CI);
+ return true;
+ }
}
return false;
OpenPOWER on IntegriCloud