[llvm] [InstCombine] Fold xor(zext(or disjoint X, C1), C2) (PR #214970)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 8 09:56:24 PDT 2026
=?utf-8?b?7KGw7JiB7KeEKEpveW91bmdqaW4p?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/214970 at github.com>
================
@@ -1775,6 +1775,27 @@ static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,
Type *DestTy = Logic.getType();
Type *SrcTy = Cast->getSrcTy();
+ // xor (zext (or disjoint X, NarrowC)), WideC
+ // -> xor (zext X), WideC ^ zext(NarrowC)
+ if (LogicOpc == Instruction::Xor && SrcTy->isIntegerTy() &&
----------------
andjo403 wrote:
as this will only be valid for xor feels like this belong in visitXor instead of foldLogicCastConstant
https://github.com/llvm/llvm-project/pull/214970
More information about the llvm-commits
mailing list