[PATCH] D29399: [X86][SSE] Combine shuffle nodes with multiple uses if all the users are being combined.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 04:09:21 PST 2017


andreadb accepted this revision.
andreadb added a comment.
This revision is now accepted and ready to land.

Hi Simon,
thanks for the extra tests.

The patch looks good to me.



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:7129-7141
+bool SDNode::areOnlyUsersOf(ArrayRef<const SDNode *> Nodes, const SDNode *N) {
+  bool Seen = false;
+  for (SDNode::use_iterator I = N->use_begin(), E = N->use_end(); I != E; ++I) {
+    SDNode *User = *I;
+    if (llvm::any_of(Nodes,
+                     [&User](const SDNode *Node) { return User == Node; }))
+      Seen = true;
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D29399





More information about the llvm-commits mailing list