[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:53:36 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:
> This seems like two unrelated changes? One is the assume handling, and the other is xor -> disjoint or fold. These should be separated.
>
> If we want to do the latter, it should probably be part of demanded bits simplification, which already computes known bits.
Thanks for the review, @nikic !
Moved the xor->or fold into the existing demanded-bits code as you suggested. Now the only new thing in this PR is the assume-handling in ValueTracking.cpp. It's just reused by the existing add fold, the existing or fold, and now this xor fold, instead of adding a separate mechanism. So I don't think there are two unrelated changes left, but let me know if you'd still like this split into a separate PR.
https://github.com/llvm/llvm-project/pull/223344
More information about the llvm-commits
mailing list