Skip to content

Commit 274651b

Browse files
committed
[delinearize] Extract array dimensions from alloca and global declarations
This implements an alternative to extract multi-dimensional array information directly from alloca instructions and global variable declarations instead of relying on parsing the information from GEP instructions. The functionality for GEP delinearization remains in this patch such that we can evaluate regressions of the array_info extraction. Next patch removes the code for GEP delinearization.
1 parent 8f84295 commit 274651b

File tree

91 files changed

+1252
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1252
-560
lines changed

llvm/include/llvm/Analysis/Delinearization.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ void delinearize(ScalarEvolution &SE, const SCEV *Expr,
112112
SmallVectorImpl<const SCEV *> &Subscripts,
113113
SmallVectorImpl<const SCEV *> &Sizes, const SCEV *ElementSize);
114114

115+
/// Same as delinearize. TODO: only use delinearize() instead of other internal
116+
/// functions.
117+
bool delinearizeUsingArrayInfo(ScalarEvolution &SE, const SCEV *AccessFn,
118+
SmallVectorImpl<const SCEV *> &Subscripts,
119+
SmallVectorImpl<const SCEV *> &Sizes,
120+
const SCEV *ElementSize);
121+
115122
/// Compute the dimensions of fixed size array from \Expr and save the results
116123
/// in \p Sizes.
117124
bool findFixedSizeArrayDimensions(ScalarEvolution &SE, const SCEV *Expr,
@@ -155,6 +162,17 @@ bool getIndexExpressionsFromGEP(ScalarEvolution &SE,
155162
SmallVectorImpl<const SCEV *> &Subscripts,
156163
SmallVectorImpl<int> &Sizes);
157164

165+
/// Compute access functions for each subscript in a delinearized array access.
166+
void computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
167+
SmallVectorImpl<const SCEV *> &Subscripts,
168+
SmallVectorImpl<const SCEV *> &Sizes,
169+
const SCEV *ElementSize);
170+
171+
/// Backward compatibility wrapper for computeAccessFunctions.
172+
void computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
173+
SmallVectorImpl<const SCEV *> &Subscripts,
174+
SmallVectorImpl<const SCEV *> &Sizes);
175+
158176
/// Implementation of fixed size array delinearization. Try to delinearize
159177
/// access function for a fixed size multi-dimensional array, by deriving
160178
/// subscripts from GEP instructions. Returns true upon success and false

0 commit comments

Comments
 (0)