diff options
| -rwxr-xr-x | polly/include/polly/TempScopInfo.h | 17 | ||||
| -rw-r--r-- | polly/lib/Analysis/TempScopInfo.cpp | 13 |
2 files changed, 20 insertions, 10 deletions
diff --git a/polly/include/polly/TempScopInfo.h b/polly/include/polly/TempScopInfo.h index 63962f26d83..af0d866ef05 100755 --- a/polly/include/polly/TempScopInfo.h +++ b/polly/include/polly/TempScopInfo.h @@ -46,6 +46,14 @@ class SCEVAffFunc { LnrTransSet LnrTrans; public: + // The scalar evolution expression from which we derived this affine + // expression. + // + // We will use it to directly translation from scalar expressions to the + // corresponding isl objects. As soon as this finished, most of SCEVAffFunc + // can be removed. + const SCEV *OriginalSCEV; + // The type of the scev affine function enum SCEVAffFuncType { None = 0, @@ -72,11 +80,10 @@ public: /// @brief Create a new SCEV affine function with memory access type or /// condition type - - explicit SCEVAffFunc(SCEVAffFuncType Type, unsigned elemBytes = 0, - Value* baseAddr = 0) - : TransComp(0), BaseAddr(baseAddr), ElemBytes(elemBytes), - FuncType(Type), has_sign(true) {} + explicit SCEVAffFunc(SCEVAffFuncType Type, const SCEV *OriginalSCEV, + unsigned elemBytes = 0) + : TransComp(0), OriginalSCEV(OriginalSCEV), BaseAddr(0), + ElemBytes(elemBytes), FuncType(Type), has_sign(true) {} /// @brief Construct a new SCEVAffFunc from a SCEV /// diff --git a/polly/lib/Analysis/TempScopInfo.cpp b/polly/lib/Analysis/TempScopInfo.cpp index 62a59d640be..d96d6633f65 100644 --- a/polly/lib/Analysis/TempScopInfo.cpp +++ b/polly/lib/Analysis/TempScopInfo.cpp @@ -42,6 +42,8 @@ SCEVAffFunc::SCEVAffFunc(const SCEV *S, SCEVAffFuncType Type, Region &R, assert(S && "S can not be null!"); assert(!isa<SCEVCouldNotCompute>(S) && "Non affine function in Scop"); + OriginalSCEV = S; + for (AffineSCEVIterator I = affine_begin(S, SE), E = affine_end(); I != E; ++I) { // The constant part must be a SCEVConstant. @@ -294,7 +296,7 @@ bool TempScopInfo::isReduction(BasicBlock &BB) { return false; } -void TempScopInfo::buildAccessFunctions(Region &R, ParamSetType &Params, +void TempScopInfo::buildAccessFunctions(Region &R, ParamSetType &Parameter, BasicBlock &BB) { AccFuncSetType Functions; @@ -313,10 +315,11 @@ void TempScopInfo::buildAccessFunctions(Region &R, ParamSetType &Params, Type = SCEVAffFunc::WriteMem; } - Functions.push_back(std::make_pair(SCEVAffFunc(Type, Size), &Inst)); + const SCEV *AccessFunction = SE->getSCEV(getPointerOperand(Inst)); + Functions.push_back( + std::make_pair(SCEVAffFunc(Type, AccessFunction, Size), &Inst)); - Value *Ptr = getPointerOperand(Inst); - buildAffineFunction(SE->getSCEV(Ptr), Functions.back().first, R, Params); + buildAffineFunction(AccessFunction, Functions.back().first, R, Parameter); } } @@ -341,8 +344,8 @@ void TempScopInfo::buildLoopBounds(TempScop &Scop) { if (LoopBounds.find(L) != LoopBounds.end()) continue; - LoopBounds[L] = SCEVAffFunc(SCEVAffFunc::Eq); const SCEV *LoopCount = SE->getBackedgeTakenCount(L); + LoopBounds[L] = SCEVAffFunc(SCEVAffFunc::Eq, LoopCount); buildAffineFunction(LoopCount, LoopBounds[L], Scop.getMaxRegion(), Scop.getParamSet()); |

