[llvm] [InstCombine] Fold `(add X, (sext/zext (icmp eq X, C)))` (PR #93840)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 30 10:52:04 PDT 2024
================
@@ -1694,6 +1694,26 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
return BinaryOperator::CreateOr(LHS, Zext);
}
+ {
+ Value *Cond, *Ext;
+ Constant *C;
+ // (add X, (sext/zext (icmp eq X, C)))
+ // -> (select (icmp eq X, C), (add C, (sext/zext 1)), X)
----------------
goldsteinn wrote:
Yeah sorry, updated desc.
https://github.com/llvm/llvm-project/pull/93840
More information about the llvm-commits
mailing list