[PATCH] D153698: [InstCombine] canonicalize multi xor as cmp+select

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 00:57:39 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4276
   transform(I->operands(), NewOps.begin(),
             [&](Value *V) { return V == Op ? RepOp : V; });
 
----------------
Allen wrote:
> nikic wrote:
> > This isn't what I had in mind. Why can't we do the recursive call in here?
> I think there is conflict on the solution.
> we need check **!is_contained(I->operands(), Op)** then entry the  recursive call , while in the transform, we can't get all the **operands of I**
You need to keep track whether an operand has been replaced or not. Previously this was just done by is_contained, but now you would have to check the return value of the recursive simplifyWithOpReplaced. If there is no replacement, the following code can be skipped.


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

https://reviews.llvm.org/D153698



More information about the llvm-commits mailing list