[llvm] [DAGCombiner] Fix ReplaceAllUsesOfValueWith mutation bug in visitFREEZE (PR #104924)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 08:13:35 PDT 2024


bjope wrote:

> You could use HandleSDNode, but I'm not sure how much cleaner it would be (you'd need to track the ResNo manually)

I don't think the proposed solution is very ugly compared to the prior to the patch (except possibly the thing with using both a Set and a Vector instead just a SetVector).  And there is not much extra work in the second loop, considering that we need to refetch the operands (unless we use  a more complicated solution, which I think it would be if using HandleSDNode, or if using a DAGUpdateListener, or if checking if the operands has mutated etc).

I kind of wondered if it perhaps could be possible to rewrite that loop completely by using some existing function to update lots of users in a safe way.

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


More information about the llvm-commits mailing list