[PATCH] InstCombineSimplifyDemanded: Remove nsw/nuw flags when optimizing demanded bits

David Majnemer david.majnemer at gmail.com
Thu Apr 30 14:42:26 PDT 2015


In http://reviews.llvm.org/D9415#164416, @MatzeB wrote:

> Turns out PR11449 was already fixed before this patch. The patch is still necessary for the more complicated testcase that is included.


Yes, I fixed PR23309 with r235544 and followed it up with r235558.  I didn't realize that PR11449 was already filed.  Looks like I missed something though, happy to see a more comprehensive solution. :)


REPOSITORY
  rL LLVM

================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:522
@@ +521,3 @@
+    /// about the high bits of the operands.
+    uint32_t NLZ = DemandedMask.countLeadingZeros();
+    if (NLZ > 0) {
----------------
Any reason why you changed this? `countLeadingZeros` returns an `unsigned`.

================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:524
@@ -617,1 +523,3 @@
+    if (NLZ > 0) {
+      // Right fill the mask of bits for this ADD to demand the most
       // significant bit and all those below it.
----------------
Update this comment to read for both ADD and SUB?

http://reviews.llvm.org/D9415

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list