diff options
author | Sebastian Pop <spop@codeaurora.org> | 2014-05-27 22:41:51 +0000 |
---|---|---|
committer | Sebastian Pop <spop@codeaurora.org> | 2014-05-27 22:41:51 +0000 |
commit | 28e6b97b5de6b0cd0bf3e85bd1bcc14a7b261a9b (patch) | |
tree | 41f8edd8883b0a932749188ae737faf0fd7be765 /llvm/lib/Analysis/Delinearization.cpp | |
parent | a6e586051388a83198e5e0f1092657a2fc78e133 (diff) | |
download | bcm5719-llvm-28e6b97b5de6b0cd0bf3e85bd1bcc14a7b261a9b.tar.gz bcm5719-llvm-28e6b97b5de6b0cd0bf3e85bd1bcc14a7b261a9b.zip |
remove BasePointer before delinearizing
No functional change is intended: instead of relying on the delinearization to
come up with the base pointer as a remainder of the divisions in the
delinearization, we just compute it from the array access and use that value.
We substract the base pointer from the SCEV to be delinearized and that
simplifies the work of the delinearizer.
llvm-svn: 209692
Diffstat (limited to 'llvm/lib/Analysis/Delinearization.cpp')
-rw-r--r-- | llvm/lib/Analysis/Delinearization.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/Delinearization.cpp b/llvm/lib/Analysis/Delinearization.cpp index 6c8702787d4..9334cebe180 100644 --- a/llvm/lib/Analysis/Delinearization.cpp +++ b/llvm/lib/Analysis/Delinearization.cpp @@ -95,26 +95,34 @@ void Delinearization::print(raw_ostream &O, const Module *) const { // Do not analyze memory accesses outside loops. for (Loop *L = LI->getLoopFor(BB); L != nullptr; L = L->getParentLoop()) { const SCEV *AccessFn = SE->getSCEVAtScope(getPointerOperand(*Inst), L); + + const SCEVUnknown *BasePointer = + dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFn)); + // Do not delinearize if we cannot find the base pointer. + if (!BasePointer) + break; + AccessFn = SE->getMinusSCEV(AccessFn, BasePointer); const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(AccessFn); // Do not try to delinearize memory accesses that are not AddRecs. if (!AR) break; + O << "\n"; O << "Inst:" << *Inst << "\n"; O << "In Loop with Header: " << L->getHeader()->getName() << "\n"; - O << "AddRec: " << *AR << "\n"; SmallVector<const SCEV *, 3> Subscripts, Sizes; - const SCEV *Res = AR->delinearize(*SE, Subscripts, Sizes, SE->getElementSize(Inst)); + AR->delinearize(*SE, Subscripts, Sizes, SE->getElementSize(Inst)); if (Subscripts.size() == 0 || Sizes.size() == 0 || Subscripts.size() != Sizes.size()) { O << "failed to delinearize\n"; continue; } - O << "Base offset: " << *Res << "\n"; + + O << "Base offset: " << *BasePointer << "\n"; O << "ArrayDecl[UnknownSize]"; int Size = Subscripts.size(); for (int i = 0; i < Size - 1; i++) |