[PATCH] D31715: [SelectionDAG] TargetLowering::SimplifyDemandedBits how to properly calculate KnownZero bits for ISD::SETCC and ISD::AssertZExt

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 12:14:47 PDT 2017


craig.topper updated this revision to Diff 94268.
craig.topper added a comment.

Addressed Simon's comment.


https://reviews.llvm.org/D31715

Files:
  lib/CodeGen/SelectionDAG/TargetLowering.cpp


Index: lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -791,6 +791,10 @@
       // TODO: Should we check for other forms of sign-bit comparisons?
       // Examples: X <= -1, X >= 0
     }
+    if (getBooleanContents(Op0.getValueType()) ==
+            TargetLowering::ZeroOrOneBooleanContent &&
+        BitWidth > 1)
+      KnownZero.setBitsFrom(1);
     break;
   }
   case ISD::SHL:
@@ -1233,7 +1237,7 @@
       return true;
     assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
 
-    KnownZero |= ~InMask & NewMask;
+    KnownZero |= ~InMask;
     break;
   }
   case ISD::BITCAST:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31715.94268.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170405/2ff095f4/attachment.bin>


More information about the llvm-commits mailing list