[llvm] 7a18198 - [InstCombine] Fix nits in new xor fold

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 02:59:46 PDT 2024


Author: Nikita Popov
Date: 2024-09-23T11:59:37+02:00
New Revision: 7a181980b900683fd3e1ac9601a627c758f19a61

URL: https://github.com/llvm/llvm-project/commit/7a181980b900683fd3e1ac9601a627c758f19a61
DIFF: https://github.com/llvm/llvm-project/commit/7a181980b900683fd3e1ac9601a627c758f19a61.diff

LOG: [InstCombine] Fix nits in new xor fold

Followup to https://github.com/llvm/llvm-project/pull/105992,
use the simplifyXorInst helper and use getWithInstruction
consistently.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 56aac0edc5335c..80d3adedfc89f3 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -4699,11 +4699,10 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
   // (X | Y) ^ M -> (Y ^ M) ^ X
   if (match(&I, m_c_Xor(m_OneUse(m_DisjointOr(m_Value(X), m_Value(Y))),
                         m_Value(M)))) {
-    if (Value *XorAC =
-            simplifyBinOp(Instruction::Xor, X, M, SQ.getWithInstruction(&I)))
+    if (Value *XorAC = simplifyXorInst(X, M, SQ.getWithInstruction(&I)))
       return BinaryOperator::CreateXor(XorAC, Y);
 
-    if (Value *XorBC = simplifyBinOp(Instruction::Xor, Y, M, SQ))
+    if (Value *XorBC = simplifyXorInst(Y, M, SQ.getWithInstruction(&I)))
       return BinaryOperator::CreateXor(XorBC, X);
   }
 


        


More information about the llvm-commits mailing list