[all-commits] [llvm/llvm-project] 350b4d: [mlir][IR] Hash nesting structure in OperationFing...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Wed May 24 06:02:19 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 350b4d05e85ece30bd9f02be410b4bcb90af7a42
https://github.com/llvm/llvm-project/commit/350b4d05e85ece30bd9f02be410b4bcb90af7a42
Author: Matthias Springer <me at m-sp.org>
Date: 2023-05-24 (Wed, 24 May 2023)
Changed paths:
M mlir/lib/IR/OperationSupport.cpp
Log Message:
-----------
[mlir][IR] Hash nesting structure in OperationFingerPrint
The following ops currently have the same finger print, even though they are different:
```
func.func @test() {
"test.foo"() ({
"test.bar"() : () -> ()
}) : () -> ()
}
```
And:
```
func.func @test() {
"test.bar"() : () -> ()
"test.foo"() ({ }) : () -> ()
}
```
The SHA1 hash used in OperationFingerPrint is order-sensitive, but the ops are hashed in the same order (post-order traversal), so the hash is the same. Switching to pre-order traversal does not solve the issue; a similar example, where IR differs just in its nesting structure, can be constructed.
The problem is solved by hashing the parent op pointer. (Alternatively, a traversal over the IR that hashes scope markers (`{}`) could be used.)
Differential Revision: https://reviews.llvm.org/D151306
More information about the All-commits
mailing list