[llvm] r300430 - [InstCombine] In SimplifyDemandedUseBits, don't bother to mask known bits of constants with DemandedMask.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 16 13:55:58 PDT 2017


Author: ctopper
Date: Sun Apr 16 15:55:58 2017
New Revision: 300430

URL: http://llvm.org/viewvc/llvm-project?rev=300430&view=rev
Log:
[InstCombine] In SimplifyDemandedUseBits, don't bother to mask known bits of constants with DemandedMask.

Just because we didn't demand them doesn't mean they aren't known.

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

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=300430&r1=300429&r2=300430&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Sun Apr 16 15:55:58 2017
@@ -120,14 +120,14 @@ Value *InstCombiner::SimplifyDemandedUse
   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 & DemandedMask;
-    KnownZero = ~KnownOne & DemandedMask;
+    KnownOne = *C;
+    KnownZero = ~KnownOne;
     return nullptr;
   }
   if (isa<ConstantPointerNull>(V)) {
     // We know all of the bits for a constant!
     KnownOne.clearAllBits();
-    KnownZero = DemandedMask;
+    KnownZero.setAllBits();
     return nullptr;
   }
 




More information about the llvm-commits mailing list