@@ -70,6 +70,13 @@ namespace {
7070
7171using LoopVector = SmallVector<Loop *, 8 >;
7272
73+ // / A list of direction vectors. Each entry represents a direction vector
74+ // / corresponding to one or more dependencies existing in the loop nest. The
75+ // / length of all direction vectors is equal and is N + 1, where N is the depth
76+ // / of the loop nest. The first N elements correspond to the dependency
77+ // / direction of each N loops. The last one indicates whether this entry is
78+ // / forward dependency ('<') or not ('*'). The term "forward" aligns with what
79+ // / is defined in LoopAccessAnalysis.
7380// TODO: Check if we can use a sparse matrix here.
7481using CharMatrix = std::vector<std::vector<char >>;
7582
@@ -128,8 +135,8 @@ static void printDepMatrix(CharMatrix &DepMatrix) {
128135 for (auto &Row : DepMatrix) {
129136 ArrayRef<char > RowRef (Row);
130137
131- // Drop the last element because it is a flag indicating whether the row is
132- // "lexically forward" , which doesn't affect the legality check.
138+ // Drop the last element because it is a flag indicating whether this is
139+ // forward dependency or not , which doesn't affect the legality check.
133140 for (auto D : RowRef.drop_back ())
134141 LLVM_DEBUG (dbgs () << D << " " );
135142 LLVM_DEBUG (dbgs () << " \n " );
@@ -1387,8 +1394,9 @@ static bool canVectorize(const CharMatrix &DepMatrix, unsigned LoopId) {
13871394 if (Dir == ' =' || Dir == ' I' )
13881395 continue ;
13891396
1390- // If both Dir and DepType are '<', it means that the all dependencies are
1391- // lexically forward. Such dependencies don't prevent vectorization.
1397+ // DepType being '<' means that this direction vector represents a forward
1398+ // dependency. In principle, a loop with '<' direction can be vectorized in
1399+ // this case.
13921400 if (Dir == ' <' && DepType == ' <' )
13931401 continue ;
13941402
0 commit comments