[PATCH] D36439: [InstCombine] Simplify and merge FoldOrWithConstants/FoldXorWithConstants

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 13 15:05:45 PDT 2017


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1968-1972
     // ((A|B)&1)|(B&-2) -> (A&1) | B
     if (match(A, m_c_Or(m_Value(V1), m_Specific(B)))) {
-      if (Instruction *Ret = FoldOrWithConstants(I, Op1, V1, B, C, Builder))
+      if (Instruction *Ret = FoldOrXorWithConstants(BinaryOperator::Or,
+                                                    V1, B, C, D, Builder))
         return Ret;
----------------
It looks functionally correct now, but I'm finding it hard to follow the matchers because we do half of it down here and then finish up in the helper. It also doesn't help that the comment formula variables don't line up with the code ('A' in the formula above is 'V1' in the code?). Can we just match the constants down here and get rid of the helper? Or move these initial matchers into the helper?


https://reviews.llvm.org/D36439





More information about the llvm-commits mailing list