From e7816b5c9e73635686b6a28a0e3d8c5593348916 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Thu, 8 Mar 2007 01:52:58 +0000 Subject: [PATCH] For PR1205: Provide an APIntified version of MaskedValueIsZero. This will (temporarily) cause a "defined but not used" message from the compiler. It will be used in the next patch in this series. Patch by Sheng Zhou. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35019 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index a1d9e978329..9d327c7883d 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -979,6 +979,16 @@ static bool MaskedValueIsZero(Value *V, uint64_t Mask, unsigned Depth = 0) { return (KnownZero & Mask) == Mask; } +/// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use +/// this predicate to simplify operations downstream. Mask is known to be zero +/// for bits that V cannot have. +static bool MaskedValueIsZero(Value *V, const APInt& Mask, unsigned Depth = 0) { + APInt KnownZero(Mask), KnownOne(Mask); + ComputeMaskedBits(V, Mask, KnownZero, KnownOne, Depth); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + return (KnownZero & Mask) == Mask; +} + /// ShrinkDemandedConstant - Check to see if the specified operand of the /// specified instruction is a constant integer. If so, check to see if there /// are any bits set in the constant that are not demanded. If so, shrink the