[llvm] [InstCombine] Fold zext(and/or/xor(trunc nuw x), y) -> and/or/xor(zext(y), x) (PR #204927)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 20 06:07:54 PDT 2026
================
@@ -1692,6 +1692,15 @@ Instruction *InstCombinerImpl::visitZExt(ZExtInst &Zext) {
return BinaryOperator::CreateAnd(X, ZextC);
}
+ Value *Y;
+ if (match(Src,
+ m_OneUse(m_c_BitwiseLogic(m_NUWTrunc(m_Value(X)), m_Value(Y)))) &&
+ X->getType() == DestTy) {
+ Value *ZextC = Builder.CreateZExt(Y, DestTy);
----------------
dtcxzyw wrote:
Use `ZextY` instead? `ZExtC` means zero extension of a constant...
https://github.com/llvm/llvm-project/pull/204927
More information about the llvm-commits
mailing list