[llvm] [DAGCombiner] Set shift flags during visit. (PR #91239)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 20:27:35 PDT 2024


topperc wrote:

> I'm a bit surprised this code works. Shouldn't the new node have tried to CSE with the original node? I thought that would intersect the flags causing the new flags to be dropped.

It doesn't work. It always CSEs the node and drops the flags. Because `setShiftFlags` returns a node, no other combines runs. But because it returns the original node, the main combiner loop thinks worklist management was done elsewhere and doesn't re-queue the node. Which would cause an infinite loop.

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


More information about the llvm-commits mailing list