[Mlir-commits] [mlir] [MLIR][LLVM] Use CyclicReplacerCache for recursive DIType import (PR #98203)

Billy Zhu llvmlistbot at llvm.org
Thu Aug 1 11:09:22 PDT 2024


zyx-billy wrote:

Ohhh... I see. There's no guarantee from this import algo that we'll never see a node 3 times. If not all nodes can break cycles, having multiple back-edges will cause it to die.
```
0 -> 1
1 -> 2, 3
2 -> 0
3 -> 0
```
Everything goes fine when looping through the first loop until we reach the second loop 🤦 
```
0 -> 1 -> 2 -> 0 -> 1 -> 2'
                      -> 3 -> 0
```

Thanks for the repro btw. Very easy to digest. It seems having a cycle-breaking node in each loop is not enough to guarantee we never see a node 3 times. We have to make sure it's impossible to walk the graph so that you can go through a node 3 times before visiting a cycle-breaking node twice (and in this case such a violating path would be `0 -> 1 -> 2 -> 0 -> 1 -> 3 -> 0`). So I totally agree with your concern... can we do this without requiring all nodes to be cycle-breaking 🤔 (or is anything special with `0` that we can use to refine our rule).

https://github.com/llvm/llvm-project/pull/98203


More information about the Mlir-commits mailing list