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

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 11:07:36 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL299839: [SelectionDAG] TargetLowering::SimplifyDemandedBits how to properly calculateā€¦ (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D31715?vs=94268&id=94645#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31715

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp


Index: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ llvm/trunk/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.94645.patch
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/0e2eaff8/attachment.bin>


More information about the llvm-commits mailing list