[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.

llvm-svn: 300430
This commit is contained in:
Craig Topper 2017-04-16 20:55:58 +00:00
parent f5f593b674
commit 0d304f01b4
1 changed files with 3 additions and 3 deletions

View File

@ -120,14 +120,14 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
const APInt *C; const APInt *C;
if (match(V, m_APInt(C))) { if (match(V, m_APInt(C))) {
// We know all of the bits for a scalar constant or a splat vector constant! // We know all of the bits for a scalar constant or a splat vector constant!
KnownOne = *C & DemandedMask; KnownOne = *C;
KnownZero = ~KnownOne & DemandedMask; KnownZero = ~KnownOne;
return nullptr; return nullptr;
} }
if (isa<ConstantPointerNull>(V)) { if (isa<ConstantPointerNull>(V)) {
// We know all of the bits for a constant! // We know all of the bits for a constant!
KnownOne.clearAllBits(); KnownOne.clearAllBits();
KnownZero = DemandedMask; KnownZero.setAllBits();
return nullptr; return nullptr;
} }