[llvm-commits] CVS:	llvm/lib/Transforms/Scalar/InstructionCombining.cpp
    Reid Spencer 
    reid at x10sys.com
       
    Wed Mar  7 17:53:15 PST 2007
    
    
  
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.649 -> 1.650
---
Log message:
For PR1205: http://llvm.org/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.
---
Diffs of the changes:  (+10 -0)
 InstructionCombining.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.649 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.650
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.649	Wed Mar  7 19:46:38 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Mar  7 19:52:58 2007
@@ -979,6 +979,16 @@
   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
    
    
More information about the llvm-commits
mailing list