-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[LoopCacheAnalysis] Replace delinearization for fixed size array #164798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
bd15ed3
b3ddbf2
4c2b0e2
1966fe0
3cf3107
6f791f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -355,22 +355,18 @@ CacheCostTy IndexedReference::computeRefCost(const Loop &L, | |
| } | ||
|
|
||
| bool IndexedReference::tryDelinearizeFixedSize( | ||
| const SCEV *AccessFn, SmallVectorImpl<const SCEV *> &Subscripts) { | ||
| SmallVector<int, 4> ArraySizes; | ||
| if (!tryDelinearizeFixedSizeImpl(&SE, &StoreOrLoadInst, AccessFn, Subscripts, | ||
| ArraySizes)) | ||
| const SCEV *AccessFn, SmallVectorImpl<const SCEV *> &Subscripts, | ||
| const SCEV *ElementSize) { | ||
| const SCEV *Offset = SE.removePointerBase(AccessFn); | ||
| if (!delinearizeFixedSizeArray(SE, Offset, Subscripts, Sizes, ElementSize)) { | ||
| Sizes.clear(); | ||
| return false; | ||
| } | ||
|
|
||
| // Populate Sizes with scev expressions to be used in calculations later. | ||
| for (auto Idx : seq<unsigned>(1, Subscripts.size())) | ||
| Sizes.push_back( | ||
| SE.getConstant(Subscripts[Idx]->getType(), ArraySizes[Idx - 1])); | ||
|
|
||
| LLVM_DEBUG({ | ||
| dbgs() << "Delinearized subscripts of fixed-size array\n" | ||
| << "GEP:" << *getLoadStorePointerOperand(&StoreOrLoadInst) | ||
| << "\n"; | ||
| }); | ||
| // Drop the last element of Sizes which is the same as ElementSize. | ||
| assert(!Sizes.empty() && Sizes.back() == ElementSize && | ||
| "Expecting the last one to be the element size"); | ||
|
||
| Sizes.pop_back(); | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -397,7 +393,7 @@ bool IndexedReference::delinearize(const LoopInfo &LI) { | |
|
|
||
| bool IsFixedSize = false; | ||
| // Try to delinearize fixed-size arrays. | ||
| if (tryDelinearizeFixedSize(AccessFn, Subscripts)) { | ||
| if (tryDelinearizeFixedSize(AccessFn, Subscripts, ElemSize)) { | ||
| IsFixedSize = true; | ||
| // The last element of Sizes is the element size. | ||
| Sizes.push_back(ElemSize); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think this is self-evident from the assert and line 369, but maybe the more interesting question is why we drop that element, so maybe you can leave a little comment about that.