[llvm] [ValueTracking] Compute known bits of or/and/xor recurrences from start and step (PR #222334)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 01:51:39 PDT 2026


================
@@ -1919,8 +1920,17 @@ static void computeKnownBitsFromOperator(const Operator *I,
         RecQ.CxtI = LatchTerm;
         computeKnownBits(Step, DemandedElts, KnownStep, RecQ, Depth + 1);
 
-        Known.Zero.setLowBits(std::min(KnownStart.countMinTrailingZeros(),
-                                       KnownStep.countMinTrailingZeros()));
+        if (Opcode == Instruction::Or || Opcode == Instruction::Xor) {
----------------
jayfoad wrote:

For Xor there is a missed case here, you could do:
```
  Known.One |= KnownStart.One & KnownStep.Zero;
```

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


More information about the llvm-commits mailing list