/// indirect operand.
bool hasOperand(const SCEV *S, const SCEV *Op) const;
+ /// Compute the array dimensions Sizes from the set of Terms extracted from
+ /// the memory access function of this SCEVAddRecExpr.
+ void findArrayDimensions(SmallVectorImpl<const SCEV *> &Terms,
+ SmallVectorImpl<const SCEV *> &Sizes) const;
+
bool runOnFunction(Function &F) override;
void releaseMemory() override;
void getAnalysisUsage(AnalysisUsage &AU) const override;
void collectParametricTerms(ScalarEvolution &SE,
SmallVectorImpl<const SCEV *> &Terms) const;
- /// Compute the array dimensions Sizes from the set of Terms extracted from
- /// the memory access function of this SCEVAddRecExpr.
- void findArrayDimensions(ScalarEvolution &SE,
- SmallVectorImpl<const SCEV *> &Terms,
- SmallVectorImpl<const SCEV *> &Sizes) const;
-
/// Return in Subscripts the access functions for each dimension in Sizes.
const SCEV *
computeAccessFunctions(ScalarEvolution &SE,
static void findArrayDimensionsRec(ScalarEvolution &SE,
SmallVectorImpl<const SCEV *> &Terms,
- SmallVectorImpl<const SCEV *> &Sizes,
- const SCEV *Zero, const SCEV *One) {
+ SmallVectorImpl<const SCEV *> &Sizes) {
// The GCD of all Terms is the dimension of the innermost dimension.
const SCEV *GCD = findGCD(SE, Terms);
return;
}
+ const SCEV *Zero = SE.getConstant(GCD->getType(), 0);
+
for (unsigned I = 0; I < Terms.size(); ++I) {
// Normalize the terms before the next call to findArrayDimensionsRec.
const SCEV *Q, *R;
Terms.end());
if (Terms.size() > 0)
- findArrayDimensionsRec(SE, Terms, Sizes, Zero, One);
+ findArrayDimensionsRec(SE, Terms, Sizes);
Sizes.push_back(GCD);
}
/// Second step of delinearization: compute the array dimensions Sizes from the
/// set of Terms extracted from the memory access function of this SCEVAddRec.
-void SCEVAddRecExpr::findArrayDimensions(
- ScalarEvolution &SE, SmallVectorImpl<const SCEV *> &Terms,
+void ScalarEvolution::findArrayDimensions(
+ SmallVectorImpl<const SCEV *> &Terms,
SmallVectorImpl<const SCEV *> &Sizes) const {
if (Terms.size() < 2)
dbgs() << *T << "\n";
});
- const SCEV *Zero = SE.getConstant(this->getType(), 0);
- const SCEV *One = SE.getConstant(this->getType(), 1);
- findArrayDimensionsRec(SE, Terms, Sizes, Zero, One);
+ ScalarEvolution &SE = *const_cast<ScalarEvolution *>(this);
+ findArrayDimensionsRec(SE, Terms, Sizes);
DEBUG({
dbgs() << "Sizes:\n";
collectParametricTerms(SE, Terms);
// Second step: find subscript sizes.
- findArrayDimensions(SE, Terms, Sizes);
+ SE.findArrayDimensions(Terms, Sizes);
// Third step: compute the access functions for each subscript.
const SCEV *Remainder = computeAccessFunctions(SE, Subscripts, Sizes);