Currently we only combine shuffle nodes if they have a single user to prevent us from causing code bloat by splitting the shuffles into several different combines.
We don't take into account that in some cases we will already have combined all the users during recursively calling up the shuffle tree.
This patch keeps a list of all the shuffle nodes that have been combined so far and permits combining of further shuffle nodes if all its users are in that list.
Correct me if I am wrong.
We can only return false from line 7140 if N has no users.
Assuming that the use_empty() is a valid scenario, you can slightly simplify the code by adding an early check to N->use_empty() at the beginning of the function.