Make test more flexible with regard to ordering. Additionally, FileCheck
cannot test -SAME patterns after DAG, so duplicate the line manually.
Does that mean if we change the DenseMap hash, the test output will change? That seems pretty unfortunate. Can you sort the edges/nodes/etc. somehow to avoid this (either before or after dumping)?
The dot file is not invalid, but the output is sensitive to "arbitrary order" as you mentioned: this is not desirable. We should strive toward canonicalizing toward an order independent of the container properties.
So instead of iterating a DenseMap and emitting the output, there should be another step that sort the nodes in a deterministic way.
Actually this is already implemented for the bitcode emission I believe, even if the bitcode wouldn't be invalid either. The same logic should also be done for the DOT emission I believe.