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
3131 auto func = getOperation ();
3232 if (func.getBody ().empty ())
3333 return ;
34- std::vector <llvm::SmallVector<Operation *, 4 >> groupedOps;
34+ llvm::SmallVector <llvm::SmallVector<Operation *, 4 >, 4 > groupedOps;
3535 // populate the top level for-loop
3636 for (auto topIt = func.getBody ().front ().begin ();
3737 topIt != func.getBody ().front ().end ();) {
@@ -69,13 +69,14 @@ struct AddOuterParallelLoopPass
6969 it = std::next (it);
7070 }
7171 if (!hasReturnOp) {
72- Block::iterator endIt = ++ endOp->getIterator ();
72+ Block::iterator endIt = std::next ( endOp->getIterator () );
7373 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) ) {
7676 ops.push_back (&*it);
7777 }
78- groupedOps.push_back (ops);
78+ if (!ops.empty ())
79+ groupedOps.push_back (ops);
7980 }
8081 }
8182 // 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