[Mlir-commits] [mlir] [mlir][IR] `OperationFingerPrint`: Do not hash block pointers (PR #78255)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Jan 16 02:51:25 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Matthias Springer (matthias-springer)
<details>
<summary>Changes</summary>
Two blocks can be equivalent even though their allocated `Block *` do not match. Therefore, they should not be taken into account when computing an operation finger print. (This is consistent with `OperationEquivalence`, which also does not compare `Block *`.)
Furthermore, in addition to operation locations, block argument location should also be hashed. (Block argument locations can differ from operation locations.)
---
Full diff: https://github.com/llvm/llvm-project/pull/78255.diff
1 Files Affected:
- (modified) mlir/lib/IR/OperationSupport.cpp (+3-2)
``````````diff
diff --git a/mlir/lib/IR/OperationSupport.cpp b/mlir/lib/IR/OperationSupport.cpp
index e10cd748e03ba5..c76dc4e8f3d949 100644
--- a/mlir/lib/IR/OperationSupport.cpp
+++ b/mlir/lib/IR/OperationSupport.cpp
@@ -928,9 +928,10 @@ OperationFingerPrint::OperationFingerPrint(Operation *topOp) {
// - Blocks in Regions
for (Region ®ion : op->getRegions()) {
for (Block &block : region) {
- addDataToHash(hasher, &block);
- for (BlockArgument arg : block.getArguments())
+ for (BlockArgument arg : block.getArguments()) {
addDataToHash(hasher, arg);
+ addDataToHash(hasher, arg.getLoc().getAsOpaquePointer());
+ }
}
}
// - Location
``````````
</details>
https://github.com/llvm/llvm-project/pull/78255
More information about the Mlir-commits
mailing list