[PATCH] D134477: [X86] Lower vector interleave into unpck and perm

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 16:00:11 PDT 2022


MatzeB added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:17841
+    DAG.ReplaceAllUsesWith(SecondHalf, &Perm2);
+    return Perm1;
+  }
----------------
zhuhan0 wrote:
> RKSimon wrote:
> > Why are the ReplaceAllUsesWith calls necessary? We usually just rely on combines / demandedelts to replace these.
> Because in [SelectionDAGLegalize::LegalizeOp](https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L1304) only the currently visited node is replaced in the DAG, but here we're trying to transform both vector shuffle nodes, so I replaced the other (not currently visited) node on the fly. This does seem weird so I'm happy to change it if there's a better way. Is there an example of using "combines / demandedelts" to replace multiple nodes at the same time? 
I think this is normal code when dealing with patterns that have multiple "root nodes".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134477/new/

https://reviews.llvm.org/D134477



More information about the llvm-commits mailing list