[Mlir-commits] [mlir] [mlir][bufferization][NFC] Simplify helper `potentiallyAliasesMemref` (PR #78690)
Matthias Springer
llvmlistbot at llvm.org
Fri Jan 19 03:43:38 PST 2024
================
@@ -314,11 +308,13 @@ struct SplitDeallocWhenNotAliasingAnyOther
SmallVector<Value> remainingMemrefs, remainingConditions;
SmallVector<SmallVector<Value>> updatedConditions;
- for (auto [memref, cond] :
- llvm::zip(deallocOp.getMemrefs(), deallocOp.getConditions())) {
+ for (int64_t i = 0, e = deallocOp.getMemrefs().size(); i < e; ++i) {
+ Value memref = deallocOp.getMemrefs()[i];
+ Value cond = deallocOp.getConditions()[i];
+ SmallVector<Value> otherMemrefs(deallocOp.getMemrefs());
+ otherMemrefs.erase(otherMemrefs.begin() + i);
----------------
matthias-springer wrote:
I tried to write a test for that. We have another pattern that removes duplicate memrefs (`DeallocRemoveDuplicateDeallocMemrefs`). I think whether the bug is triggered or not depends on the order in which the patterns are applied. I was not able to trigger the double dealloc in practice. (I'll add the test case back anyway, just to be sure.)
https://github.com/llvm/llvm-project/pull/78690
More information about the Mlir-commits
mailing list