[llvm] [ValueTracking][InstCombine] Fold add/or/xor to disjoint or using assume(no common bits) (PR #223344)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 10:49:56 PDT 2026
================
@@ -5516,6 +5516,17 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
if (Instruction *Xor = visitMaskedMerge(I, Builder))
return Xor;
+ WithCache<const Value *> Op0Cache(Op0), Op1Cache(Op1);
----------------
prajapati-git wrote:
> Move this as late as possible. computeKnownBits is really expensive.
Rather than moving it later, I removed this switch from `visitXor` entirely and folded the logic into the existing known-bits-based `xor -> or` fold in `InstCombineSimplifyDemanded.cpp` (it now also tries `haveNoCommonBitsSet` when the plain known-bits check doesn't cover it, reusing the already-computed `LHSKnown`/`RHSKnown` instead of recomputing anything).
https://github.com/llvm/llvm-project/pull/223344
More information about the llvm-commits
mailing list