Fix a bug in the associative & commutative rewrite in constant folding:
I finally tracked it down to the case where we do the transformation:
//
// + + = parent
// / \ / \
// C + -- > X + = children
// / \ / \
// X Y C Y = leaves
when there exists a control dependency from the child '+' to C. This control dependency creates a cycle in the graph when X and C are simply swapped. We can fix it by moving the control dependency and anchoring it on Y instead (We still need it in case we are inside a frame).
PiperOrigin-RevId:
182705910