[PATCH] D141660: [InstCombine] Fold pattern xor(and, or) to select

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 05:30:13 PST 2023


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:4270
+      match(Op1, m_OneUse(m_LogicalOr(m_Value(C), m_Value(D))))) {
+    bool needFreeze = isa<SelectInst>(Op0) && isa<SelectInst>(Op1) && B == D;
+    if (B == C || B == D)
----------------
Capitalize variable name: "NeedFreeze"


================
Comment at: llvm/test/Transforms/InstCombine/xor-and-or.ll:4
 
 define i1 @xor_logic_and_logic_or1(i1 %c, i1 %x, i1 %y) {
 ; CHECK-LABEL: @xor_logic_and_logic_or1(
----------------
How does this example already get optimized? Can we remove the code that handled it?


================
Comment at: llvm/test/Transforms/InstCombine/xor-and-or.ll:200
 
 ;; TODO: do we really need to do this transform?
 define i1 @xor_and_or(i1 %c, i1 %x, i1 %y) {
----------------
Remove TODO comment.


================
Comment at: llvm/test/Transforms/InstCombine/xor-and-or.ll:213
 
 ;; TODO: do we really need to do this transform?
 define <4 x i1> @xor_and_or_vector(<4 x i1> %c, <4 x i1> %x, <4 x i1> %y) {
----------------
Remove TODO comment.


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

https://reviews.llvm.org/D141660



More information about the llvm-commits mailing list