[PATCH] D32123: [InstCombine] In SimplifyDemandedUseBits, use computeKnownBits directly to handle Constants

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 09:52:46 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300849: In SimplifyDemandedUseBits, use computeKnownBits directly to handle Constants (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D32123?vs=95420&id=95977#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32123

Files:
  llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp


Index: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
===================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -117,27 +117,16 @@
       KnownOne.getBitWidth() == BitWidth &&
       "Value *V, DemandedMask, KnownZero and KnownOne "
       "must have same BitWidth");
-  const APInt *C;
-  if (match(V, m_APInt(C))) {
-    // We know all of the bits for a scalar constant or a splat vector constant!
-    KnownOne = *C;
-    KnownZero = ~KnownOne;
-    return nullptr;
-  }
-  if (isa<ConstantPointerNull>(V)) {
-    // We know all of the bits for a constant!
-    KnownOne.clearAllBits();
-    KnownZero.setAllBits();
+
+  if (isa<Constant>(V)) {
+    computeKnownBits(V, KnownZero, KnownOne, Depth, CxtI);
     return nullptr;
   }
 
   KnownZero.clearAllBits();
   KnownOne.clearAllBits();
-  if (DemandedMask == 0) {   // Not demanding any bits from V.
-    if (isa<UndefValue>(V))
-      return nullptr;
+  if (DemandedMask == 0)     // Not demanding any bits from V.
     return UndefValue::get(VTy);
-  }
 
   if (Depth == 6)        // Limit search depth.
     return nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32123.95977.patch
Type: text/x-patch
Size: 1268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170420/ddbc4c85/attachment.bin>


More information about the llvm-commits mailing list