================
@@ -334,6 +335,15 @@ template<> struct simplify_type<User::const_op_iterator> {
   }
 };
 
+template <> struct GraphTraits<User *> {
----------------
nikic wrote:

> What's the issue with putting this here? Seems nicer than inlining yet 
> another DFS in another place.

I have a couple of concerns about exposing it here.

The first is that "DFS walk on `User *`" is not a well-defined operation. You 
can perform a DFS walk either in the direction of users or in the direction of 
operands. Keep in mind that, despite the name, the defining property of a 
`User` is that it has operands, not that it has users. Having users is a 
property of `Value *`.

The second is that even if we say that it should be a walk in the direction of 
users, we still have the choice between doing the walk on `User *` or on `Use 
&`.

The third is that doing an unbounded DFS walk on values is just a bad idea in 
general, and we should not encourage it.

For the specific problem here, I'd consider expanding all constant expressions 
in the function upfront, and then not having to deal with it.

https://github.com/llvm/llvm-project/pull/70611
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to