Skip to content

Commit 03c5f6f

Browse files
sebpopkcloudy0717
authored andcommitted
[delinearize] clear Subscripts and Sizes vectors (NFC) (llvm#156495)
1 parent 431a2b6 commit 03c5f6f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/lib/Analysis/Delinearization.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ void llvm::computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
354354
if (!AR->isAffine())
355355
return;
356356

357+
// Clear output vector.
358+
Subscripts.clear();
359+
357360
LLVM_DEBUG(dbgs() << "\ncomputeAccessFunctions\n"
358361
<< "Memory Access Function: " << *Expr << "\n");
359362

@@ -461,6 +464,10 @@ void llvm::delinearize(ScalarEvolution &SE, const SCEV *Expr,
461464
SmallVectorImpl<const SCEV *> &Subscripts,
462465
SmallVectorImpl<const SCEV *> &Sizes,
463466
const SCEV *ElementSize) {
467+
// Clear output vectors.
468+
Subscripts.clear();
469+
Sizes.clear();
470+
464471
// First step: collect parametric terms.
465472
SmallVector<const SCEV *, 4> Terms;
466473
collectParametricTerms(SE, Expr, Terms);
@@ -638,6 +645,9 @@ bool llvm::delinearizeFixedSizeArray(ScalarEvolution &SE, const SCEV *Expr,
638645
SmallVectorImpl<const SCEV *> &Subscripts,
639646
SmallVectorImpl<const SCEV *> &Sizes,
640647
const SCEV *ElementSize) {
648+
// Clear output vectors.
649+
Subscripts.clear();
650+
Sizes.clear();
641651

642652
// First step: find the fixed array size.
643653
SmallVector<uint64_t, 4> ConstSizes;

0 commit comments

Comments
 (0)