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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 09:06:01 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.
> 
> 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(...)`

Call `N->setFlags(Flags)`, add N to worklist, return N.

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


More information about the llvm-commits mailing list