[InstCombine] In SimplifyDemandedUseBits, don't bother to mask known bits of constant...
authorCraig Topper <craig.topper@gmail.com>
Sun, 16 Apr 2017 20:55:58 +0000 (20:55 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 16 Apr 2017 20:55:58 +0000 (20:55 +0000)
Just because we didn't demand them doesn't mean they aren't known.

llvm-svn: 300430

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

index 4e6f020..246fd6b 100644 (file)
@@ -120,14 +120,14 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
   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;
   }