[Mlir-commits] [mlir] 6e1ac68 - [mlir] Don't iterate mutable user list
Vitaly Buka
llvmlistbot at llvm.org
Thu Apr 28 09:00:00 PDT 2022
Author: Vitaly Buka
Date: 2022-04-28T08:59:55-07:00
New Revision: 6e1ac68a0c73546c989e2440943e4786d328f718
URL: https://github.com/llvm/llvm-project/commit/6e1ac68a0c73546c989e2440943e4786d328f718
DIFF: https://github.com/llvm/llvm-project/commit/6e1ac68a0c73546c989e2440943e4786d328f718.diff
LOG: [mlir] Don't iterate mutable user list
executeOp.operandsMutable().append(asyncTokens) in
addAsyncDependencyAfter can resize and invalidate iterators.
Fixes reports like https://reviews.llvm.org/P8286
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D124577
Added:
Modified:
mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
index 5e60696346d0..0832fcb72b8b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
@@ -208,7 +208,9 @@ struct GpuAsyncRegionPass::DeferWaitCallback {
// Add the async dependency to each user of the `async.execute` token.
auto asyncTokens = executeOp.getResults().take_back(dependencies.size());
- for (Operation *user : executeOp.token().getUsers())
+ SmallVector<Operation *, 4> users(executeOp.token().user_begin(),
+ executeOp.token().user_end());
+ for (Operation *user : users)
addAsyncDependencyAfter(asyncTokens, user);
}
}
More information about the Mlir-commits
mailing list