[PATCH] D124119: [InstCombine] Combine instructions of type or/and where AND masks can be combined.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 06:20:51 PDT 2022


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

Sorry, I lost track of this patch. LGTM - see inline comments for minor improvements.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2966
+                       m_OneUse(m_Or(m_Value(C), m_Value(D)))))) {
+    // (A & B) | (C | (A & D)) -> C | ((A & D) | (A & B))
+    // (A & B) | (C | (D & A)) -> C | ((D & A) | (A & B))
----------------
I still don't like re-using 'D' in these comments. That's the uncaptured operand in the next match, so I'd just call it '?' to show that it's a "don't care" value.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2978
+          C, Builder.CreateOr(D, Builder.CreateAnd(A, B)));
+    // (A & B) | ((A & D) | C) -> ((A & D) | (A & B)) | C
+    // (A & B) | ((D & A) | C) -> ((D & A) | (A & B)) | C
----------------
'C' is still operand 0 of the final 'or' (the same as in the above set of transforms), but these comments show it as operand 1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124119



More information about the llvm-commits mailing list