aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
diff options
context:
space:
mode:
authorMaksim Levental <maksim.levental@gmail.com>2023-10-20 20:28:32 -0500
committerGitHub <noreply@github.com>2023-10-20 20:28:32 -0500
commitbdc3e6cb45203ba59e6654da2cb7212ef3a15854 (patch)
treed533669b52777e1313afbd5fb431ceca05170055 /clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
parent7e3d1103e6e7a7fa9b5f50222732e734d171bc86 (diff)
downloadllvm-bdc3e6cb45203ba59e6654da2cb7212ef3a15854.zip
llvm-bdc3e6cb45203ba59e6654da2cb7212ef3a15854.tar.gz
llvm-bdc3e6cb45203ba59e6654da2cb7212ef3a15854.tar.bz2
[MLIR][python bindings] invalidate ops after PassManager run (#69746)
Fixes https://github.com/llvm/llvm-project/issues/69730 (also see https://reviews.llvm.org/D155543). There are two things outstanding (why I didn't land before): 1. add some C API tests for `mlirOperationWalk`; 2. potentially refactor how the invalidation in `run` works; the first version of the code looked like this: ```cpp if (invalidateOps) { auto *context = op.getOperation().getContext().get(); MlirOperationWalkCallback invalidatingCallback = [](MlirOperation op, void *userData) { PyMlirContext *context = static_cast<PyMlirContext *>(userData); context->setOperationInvalid(op); }; auto numRegions = mlirOperationGetNumRegions(op.getOperation().get()); for (int i = 0; i < numRegions; ++i) { MlirRegion region = mlirOperationGetRegion(op.getOperation().get(), i); for (MlirBlock block = mlirRegionGetFirstBlock(region); !mlirBlockIsNull(block); block = mlirBlockGetNextInRegion(block)) for (MlirOperation childOp = mlirBlockGetFirstOperation(block); !mlirOperationIsNull(childOp); childOp = mlirOperationGetNextInBlock(childOp)) mlirOperationWalk(childOp, invalidatingCallback, context, MlirWalkPostOrder); } } ``` This is verbose and ugly but it has the important benefit of not executing `mlirOperationEqual(rootOp->get(), op)` for every op underneath the root op. Supposing there's no desire for the slightly more efficient but highly convoluted approach, I can land this "posthaste". But, since we have eyes on this now, any suggestions or approaches (or needs/concerns) are welcome.
Diffstat (limited to 'clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp')
0 files changed, 0 insertions, 0 deletions