diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-08 01:52:58 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-08 01:52:58 +0000 |
commit | bb5741fb02d7f9723b61ba7efbfe1c8f95fbc1b8 (patch) | |
tree | b64198fb14dfcde87cb80349da0d19a0a5b184c6 /llvm/lib/Transforms | |
parent | aa69640b10bba5c18796435cd763bfe33cd7fb14 (diff) | |
download | bcm5719-llvm-bb5741fb02d7f9723b61ba7efbfe1c8f95fbc1b8.tar.gz bcm5719-llvm-bb5741fb02d7f9723b61ba7efbfe1c8f95fbc1b8.zip |
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.
llvm-svn: 35019
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index a1d9e978329..9d327c7883d 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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 |