File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ struct AddOuterParallelLoopPass
31
31
auto func = getOperation ();
32
32
if (func.getBody ().empty ())
33
33
return ;
34
- std::vector <llvm::SmallVector<Operation *, 4 >> groupedOps;
34
+ llvm::SmallVector <llvm::SmallVector<Operation *, 4 >, 4 > groupedOps;
35
35
// populate the top level for-loop
36
36
for (auto topIt = func.getBody ().front ().begin ();
37
37
topIt != func.getBody ().front ().end ();) {
@@ -69,13 +69,14 @@ struct AddOuterParallelLoopPass
69
69
it = std::next (it);
70
70
}
71
71
if (!hasReturnOp) {
72
- Block::iterator endIt = ++ endOp->getIterator ();
72
+ Block::iterator endIt = std::next ( endOp->getIterator () );
73
73
topIt = endIt;
74
- llvm::SmallVector<Operation *, 4 > ops; // (forOp->getIterator(), endIt);
75
- for (auto it = forOp->getIterator (); it != endIt; it++ ) {
74
+ llvm::SmallVector<Operation *, 4 > ops;
75
+ for (auto it = forOp->getIterator (); it != endIt; it = std::next (it) ) {
76
76
ops.push_back (&*it);
77
77
}
78
- groupedOps.push_back (ops);
78
+ if (!ops.empty ())
79
+ groupedOps.push_back (ops);
79
80
}
80
81
}
81
82
// move the for-loop and its users into the newly created parallel-loop
You can’t perform that action at this time.
0 commit comments