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

via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 08:23:16 PDT 2024


goldsteinn 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.

I see, any idea for how to create a flag-setting only combine?
The only things i can are either replace `return SDValue();` with `return setShiftFlags(...)`

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


More information about the llvm-commits mailing list