[mlir][sparse] hoists alloca outside the outermost loop. (#70085)
This commit is contained in:
@@ -592,8 +592,12 @@ public:
|
||||
Value lvlCoords, vref;
|
||||
{
|
||||
OpBuilder::InsertionGuard guard(rewriter);
|
||||
auto loop = op->getParentOfType<LoopLikeOpInterface>();
|
||||
if (loop) {
|
||||
Operation *loop = op;
|
||||
// Finds the outermost loop.
|
||||
while (auto l = loop->getParentOfType<LoopLikeOpInterface>())
|
||||
loop = l;
|
||||
|
||||
if (llvm::isa<LoopLikeOpInterface>(loop)) {
|
||||
// Hoists alloca outside the loop to avoid stack overflow.
|
||||
rewriter.setInsertionPoint(loop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user