[llvm] Add known and demanded bits support for zext nneg (PR #70858)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 15:00:00 PDT 2023


================
@@ -1103,6 +1103,9 @@ static void computeKnownBitsFromOperator(const Operator *I,
     assert(SrcBitWidth && "SrcBitWidth can't be zero");
     Known = Known.anyextOrTrunc(SrcBitWidth);
     computeKnownBits(I->getOperand(0), Known, Depth + 1, Q);
+    if (auto *Inst = dyn_cast<Instruction>(I);
+        Inst && Inst->getOpcode() == Instruction::ZExt && Inst->hasNonNeg())
----------------
nikic wrote:

```suggestion
    if (auto *Inst = dyn_cast<PossiblyNonNegInst>(I);
        Inst && Inst->hasNonNeg())
```

https://github.com/llvm/llvm-project/pull/70858


More information about the llvm-commits mailing list