[PATCH] D23468: [ValueTracking] Sign bit of shl cannot be both known one and known zero. Fix PR28926

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 11:25:44 PDT 2016


sanjoy requested changes to this revision.
sanjoy added a comment.
This revision now requires changes to proceed.

I've not reviewed the patch yet, but neither of the two PR numbers mentioned here seem related -- can you please check?


================
Comment at: lib/Analysis/ValueTracking.cpp:1078
@@ -1079,1 +1077,3 @@
                                       KOF);
+    // If this shift has "nsw" keyword, then the result is either a poison 
+    // value or has the same sign bit as the first operand. 
----------------
Can you do the same thing by a "normalization" step like:

```
  // Bits that are known to be "both" zero and one are arbitrarily selected to be zero.
  KnownZero |= (KnownZero & KnownOne);
  KnownOne &= ~KnownZero;
```

?

If not, now that you have this logic here, can we clear out the logic
from `KZF` and `KOF`?

Also, were you able to pinpoint _why_ we ended up with a bit both proved
to be `0` and `1`?


https://reviews.llvm.org/D23468





More information about the llvm-commits mailing list