[PATCH] D132783: [InstCombine] add support for multi-use Y of (X op Y) op Z --> (Y op Z) op X

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 28 02:13:35 PDT 2022


bcl5980 added a comment.

I agree this change help to get more opportune to combine. But I still feel a little strange for the non-deterministic transform here.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1756
   if (match(&BO, m_c_BinOp(Opcode,
-                           m_OneUse(m_c_BinOp(Opcode, m_Value(X),
-                                              m_OneUse(m_Value(Y)))),
+                           m_OneUse(m_c_BinOp(Opcode, m_Value(X), m_Value(Y))),
                            m_OneUse(m_Value(Z))))) {
----------------
m_BinOp is enough?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132783



More information about the llvm-commits mailing list