llvm.org GIT mirror llvm / 2fa0c58
don't repeat function names in comments; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275470 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 4 years ago
1 changed file(s) with 28 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
2121
2222 #define DEBUG_TYPE "instcombine"
2323
24 /// ShrinkDemandedConstant - Check to see if the specified operand of the
25 /// specified instruction is a constant integer. If so, check to see if there
26 /// are any bits set in the constant that are not demanded. If so, shrink the
27 /// constant and return true.
24 /// Check to see if the specified operand of the specified instruction is a
25 /// constant integer. If so, check to see if there are any bits set in the
26 /// constant that are not demanded. If so, shrink the constant and return true.
2827 static bool ShrinkDemandedConstant(Instruction *I, unsigned OpNo,
2928 APInt Demanded) {
3029 assert(I && "No instruction?");
4847
4948
5049
51 /// SimplifyDemandedInstructionBits - Inst is an integer instruction that
52 /// SimplifyDemandedBits knows about. See if the instruction has any
53 /// properties that allow us to simplify its operands.
50 /// Inst is an integer instruction that SimplifyDemandedBits knows about. See if
51 /// the instruction has any properties that allow us to simplify its operands.
5452 bool InstCombiner::SimplifyDemandedInstructionBits(Instruction &Inst) {
5553 unsigned BitWidth = Inst.getType()->getScalarSizeInBits();
5654 APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
6462 return true;
6563 }
6664
67 /// SimplifyDemandedBits - This form of SimplifyDemandedBits simplifies the
68 /// specified instruction operand if possible, updating it in place. It returns
69 /// true if it made any change and false otherwise.
65 /// This form of SimplifyDemandedBits simplifies the specified instruction
66 /// operand if possible, updating it in place. It returns true if it made any
67 /// change and false otherwise.
7068 bool InstCombiner::SimplifyDemandedBits(Use &U, const APInt &DemandedMask,
7169 APInt &KnownZero, APInt &KnownOne,
7270 unsigned Depth) {
7977 }
8078
8179
82 /// SimplifyDemandedUseBits - This function attempts to replace V with a simpler
83 /// value based on the demanded bits. When this function is called, it is known
84 /// that only the bits set in DemandedMask of the result of V are ever used
85 /// downstream. Consequently, depending on the mask and V, it may be possible
86 /// to replace V with a constant or one of its operands. In such cases, this
87 /// function does the replacement and returns true. In all other cases, it
88 /// returns false after analyzing the expression and setting KnownOne and known
89 /// to be one in the expression. KnownZero contains all the bits that are known
90 /// to be zero in the expression. These are provided to potentially allow the
91 /// caller (which might recursively be SimplifyDemandedBits itself) to simplify
92 /// the expression. KnownOne and KnownZero always follow the invariant that
93 /// KnownOne & KnownZero == 0. That is, a bit can't be both 1 and 0. Note that
94 /// the bits in KnownOne and KnownZero may only be accurate for those bits set
95 /// in DemandedMask. Note also that the bitwidth of V, DemandedMask, KnownZero
96 /// and KnownOne must all be the same.
80 /// This function attempts to replace V with a simpler value based on the
81 /// demanded bits. When this function is called, it is known that only the bits
82 /// set in DemandedMask of the result of V are ever used downstream.
83 /// Consequently, depending on the mask and V, it may be possible to replace V
84 /// with a constant or one of its operands. In such cases, this function does
85 /// the replacement and returns true. In all other cases, it returns false after
86 /// analyzing the expression and setting KnownOne and known to be one in the
87 /// expression. KnownZero contains all the bits that are known to be zero in the
88 /// expression. These are provided to potentially allow the caller (which might
89 /// recursively be SimplifyDemandedBits itself) to simplify the expression.
90 /// KnownOne and KnownZero always follow the invariant that:
91 /// KnownOne & KnownZero == 0.
92 /// That is, a bit can't be both 1 and 0. Note that the bits in KnownOne and
93 /// KnownZero may only be accurate for those bits set in DemandedMask. Note also
94 /// that the bitwidth of V, DemandedMask, KnownZero and KnownOne must all be the
95 /// same.
9796 ///
9897 /// This returns null if it did not change anything and it permits no
9998 /// simplification. This returns V itself if it did some simplification of V's
895894 return nullptr;
896895 }
897896
898 /// SimplifyDemandedVectorElts - The specified value produces a vector with
899 /// any number of elements. DemandedElts contains the set of elements that are
900 /// actually used by the caller. This method analyzes which elements of the
901 /// operand are undef and returns that information in UndefElts.
897 /// The specified value produces a vector with any number of elements.
898 /// DemandedElts contains the set of elements that are actually used by the
899 /// caller. This method analyzes which elements of the operand are undef and
900 /// returns that information in UndefElts.
902901 ///
903902 /// If the information about demanded elements can be used to simplify the
904903 /// operation, the operation is simplified, then the resultant value is