Skip to content

Commit 7613c24

Browse files
authored
[LoopInterchange] Use ArrayRef in more places (NFC) (#146077)
1 parent d00c83e commit 7613c24

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

llvm/lib/Transforms/Scalar/LoopInterchange.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,9 @@ static void interChangeDependencies(CharMatrix &DepMatrix, unsigned FromIndx,
244244
// [Theorem] A permutation of the loops in a perfect nest is legal if and only
245245
// if the direction matrix, after the same permutation is applied to its
246246
// columns, has no ">" direction as the leftmost non-"=" direction in any row.
247-
static std::optional<bool> isLexicographicallyPositive(std::vector<char> &DV,
248-
unsigned Begin,
249-
unsigned End) {
250-
ArrayRef<char> DVRef(DV);
251-
for (unsigned char Direction : DVRef.slice(Begin, End - Begin)) {
247+
static std::optional<bool>
248+
isLexicographicallyPositive(ArrayRef<char> DV, unsigned Begin, unsigned End) {
249+
for (unsigned char Direction : DV.slice(Begin, End - Begin)) {
252250
if (Direction == '<')
253251
return true;
254252
if (Direction == '>' || Direction == '*')
@@ -309,18 +307,18 @@ static void populateWorklist(Loop &L, LoopVector &LoopList) {
309307
LoopList.push_back(CurrentLoop);
310308
}
311309

312-
static bool hasSupportedLoopDepth(SmallVectorImpl<Loop *> &LoopList,
310+
static bool hasSupportedLoopDepth(ArrayRef<Loop *> LoopList,
313311
OptimizationRemarkEmitter &ORE) {
314312
unsigned LoopNestDepth = LoopList.size();
315313
if (LoopNestDepth < MinLoopNestDepth || LoopNestDepth > MaxLoopNestDepth) {
316314
LLVM_DEBUG(dbgs() << "Unsupported depth of loop nest " << LoopNestDepth
317315
<< ", the supported range is [" << MinLoopNestDepth
318316
<< ", " << MaxLoopNestDepth << "].\n");
319-
Loop **OuterLoop = LoopList.begin();
317+
Loop *OuterLoop = LoopList.front();
320318
ORE.emit([&]() {
321319
return OptimizationRemarkMissed(DEBUG_TYPE, "UnsupportedLoopNestDepth",
322-
(*OuterLoop)->getStartLoc(),
323-
(*OuterLoop)->getHeader())
320+
OuterLoop->getStartLoc(),
321+
OuterLoop->getHeader())
324322
<< "Unsupported depth of loop nest, the supported range is ["
325323
<< std::to_string(MinLoopNestDepth) << ", "
326324
<< std::to_string(MaxLoopNestDepth) << "].\n";
@@ -377,7 +375,7 @@ class LoopInterchangeLegality {
377375
return OuterInnerReductions;
378376
}
379377

380-
const SmallVectorImpl<PHINode *> &getInnerLoopInductions() const {
378+
const ArrayRef<PHINode *> getInnerLoopInductions() const {
381379
return InnerLoopInductions;
382380
}
383381

0 commit comments

Comments
 (0)