summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2016-03-03 22:10:47 +0000
committerMichael Kruse <llvm@meinersbur.de>2016-03-03 22:10:47 +0000
commit09eb4451d2a94995fe985d21ec802b7bb262479c (patch)
treea6ee1401aa3413ce670538a9867559d12403891f /polly/lib/Analysis/ScopDetection.cpp
parent6ad7b5aff2cf27335bb9d501816d872b8fac9100 (diff)
downloadbcm5719-llvm-09eb4451d2a94995fe985d21ec802b7bb262479c.tar.gz
bcm5719-llvm-09eb4451d2a94995fe985d21ec802b7bb262479c.zip
Pass scope and LoopInfo to SCEVValidator. NFC.
The scope will be required in the following fix. This commit separates the large changes that do not change behaviour from the small, but functional change. llvm-svn: 262664
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 47bf54786fb..548b8747c20 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -322,11 +322,12 @@ bool ScopDetection::onlyValidRequiredInvariantLoads(
return true;
}
-bool ScopDetection::isAffine(const SCEV *S, DetectionContext &Context,
+bool ScopDetection::isAffine(const SCEV *S, Loop *Scope,
+ DetectionContext &Context,
Value *BaseAddress) const {
InvariantLoadsSetTy AccessILS;
- if (!isAffineExpr(&Context.CurRegion, S, *SE, BaseAddress, &AccessILS))
+ if (!isAffineExpr(&Context.CurRegion, Scope, S, *SE, BaseAddress, &AccessILS))
return false;
if (!onlyValidRequiredInvariantLoads(AccessILS, Context))
@@ -341,7 +342,7 @@ bool ScopDetection::isValidSwitch(BasicBlock &BB, SwitchInst *SI,
Loop *L = LI->getLoopFor(&BB);
const SCEV *ConditionSCEV = SE->getSCEVAtScope(Condition, L);
- if (isAffine(ConditionSCEV, Context))
+ if (isAffine(ConditionSCEV, L, Context))
return true;
if (!IsLoopBranch && AllowNonAffineSubRegions &&
@@ -401,7 +402,7 @@ bool ScopDetection::isValidBranch(BasicBlock &BB, BranchInst *BI,
const SCEV *LHS = SE->getSCEVAtScope(ICmp->getOperand(0), L);
const SCEV *RHS = SE->getSCEVAtScope(ICmp->getOperand(1), L);
- if (isAffine(LHS, Context) && isAffine(RHS, Context))
+ if (isAffine(LHS, L, Context) && isAffine(RHS, L, Context))
return true;
if (!IsLoopBranch && AllowNonAffineSubRegions &&
@@ -537,7 +538,7 @@ bool ScopDetection::isValidIntrinsicInst(IntrinsicInst &II,
return false;
// Bail if the length is not affine.
- if (!isAffine(SE->getSCEVAtScope(cast<MemIntrinsic>(II).getLength(), L),
+ if (!isAffine(SE->getSCEVAtScope(cast<MemIntrinsic>(II).getLength(), L), L,
Context))
return false;
@@ -721,7 +722,7 @@ bool ScopDetection::hasValidArraySizes(DetectionContext &Context,
Value *BaseValue = BasePointer->getValue();
Region &CurRegion = Context.CurRegion;
for (const SCEV *DelinearizedSize : Sizes) {
- if (!isAffine(DelinearizedSize, Context, nullptr)) {
+ if (!isAffine(DelinearizedSize, Scope, Context, nullptr)) {
Sizes.clear();
break;
}
@@ -749,7 +750,7 @@ bool ScopDetection::hasValidArraySizes(DetectionContext &Context,
const Instruction *Insn = Pair.first;
const SCEV *AF = Pair.second;
- if (!isAffine(AF, Context, BaseValue)) {
+ if (!isAffine(AF, Scope, Context, BaseValue)) {
invalid<ReportNonAffineAccess>(Context, /*Assert=*/true, AF, Insn,
BaseValue);
if (!KeepGoing)
@@ -780,9 +781,10 @@ bool ScopDetection::computeAccessFunctions(
bool IsNonAffine = false;
TempMemoryAccesses.insert(std::make_pair(Insn, MemAcc(Insn, Shape)));
MemAcc *Acc = &TempMemoryAccesses.find(Insn)->second;
+ auto *Scope = LI->getLoopFor(Insn->getParent());
if (!AF) {
- if (isAffine(Pair.second, Context, BaseValue))
+ if (isAffine(Pair.second, Scope, Context, BaseValue))
Acc->DelinearizedSubscripts.push_back(Pair.second);
else
IsNonAffine = true;
@@ -792,7 +794,7 @@ bool ScopDetection::computeAccessFunctions(
if (Acc->DelinearizedSubscripts.size() == 0)
IsNonAffine = true;
for (const SCEV *S : Acc->DelinearizedSubscripts)
- if (!isAffine(S, Context, BaseValue))
+ if (!isAffine(S, Scope, Context, BaseValue))
IsNonAffine = true;
}
@@ -898,7 +900,8 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
if (Context.BoxedLoopsSet.count(L))
IsVariantInNonAffineLoop = true;
- bool IsAffine = !IsVariantInNonAffineLoop && isAffine(AF, Context, BV);
+ auto *Scope = LI->getLoopFor(Inst->getParent());
+ bool IsAffine = !IsVariantInNonAffineLoop && isAffine(AF, Scope, Context, BV);
// Do not try to delinearize memory intrinsics and force them to be affine.
if (isa<MemIntrinsic>(Inst) && !IsAffine) {
return invalid<ReportNonAffineAccess>(Context, /*Assert=*/true, AF, Inst,
OpenPOWER on IntegriCloud