[PATCH] D144760: [InstCombine] use demanded vector elements to eliminate partially redundant instructions

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 14:34:23 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1740
+      // bo X, Y --> bo X, (shuf Y)
+      for (User *U : X->users()) {
+        auto Shuf = m_Shuffle(m_Specific(Y), m_Value(), m_ZeroMask());
----------------
Think this loop should be a lambda that takes `Value * V` so you don't need to dup code for X/Y.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1743
+        if (match(U, m_BinOp(Opcode, m_Specific(X), Shuf)) ||
+            (Commute && match(U, m_BinOp(Opcode, Shuf, m_Specific(X)))))
+          if (DT.dominates(U, I))
----------------
Think:
`if(Commute ? match(U, m_c_BinOp(Opcode, m_Specific(X), Shuf)) : match(U, m_BinOp(Opcode, m_Specific(X), Shuf))` probably make more sense here.


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

https://reviews.llvm.org/D144760



More information about the llvm-commits mailing list