[llvm] [SelectionDAG] Add SDNode::user_begin() and use it in some places (PR #120509)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 21:56:37 PST 2024


================
@@ -10906,15 +10906,15 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
   // which we plan to do. This workaround can be removed once the DAG is
   // processed in topological order.
   if (N->hasOneUse()) {
-    SDNode *Use = *N->use_begin();
+    SDNode *User = *N->user_begin();
 
     // Look pass the truncate.
-    if (Use->getOpcode() == ISD::TRUNCATE && Use->hasOneUse())
-      Use = *Use->use_begin();
+    if (User->getOpcode() == ISD::TRUNCATE && User->hasOneUse())
+      User = *User->user_begin();
----------------
arsenm wrote:

Correct, the point is to handle instructions where the same value is used multiple times. It's a single user, which is usually what you want. It returns the single unique instruction which may use the value multiple times as an operand 

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


More information about the llvm-commits mailing list