[llvm] [InstCombine] Infer zext nneg flag directly (PR #71906)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 03:06:36 PST 2023
================
@@ -639,7 +641,9 @@ static Instruction *foldCtpop(IntrinsicInst &II, InstCombinerImpl &IC) {
// ctpop (zext X) --> zext (ctpop X)
if (match(Op0, m_OneUse(m_ZExt(m_Value(X))))) {
Value *NarrowPop = IC.Builder.CreateUnaryIntrinsic(Intrinsic::ctpop, X);
- return CastInst::Create(Instruction::ZExt, NarrowPop, Ty);
+ Instruction *Zext = CastInst::Create(Instruction::ZExt, NarrowPop, Ty);
+ Zext->setNonNeg();
----------------
nikic wrote:
Is this correct for i1?
https://github.com/llvm/llvm-project/pull/71906
More information about the llvm-commits
mailing list