*)
# The compiler driver will combine linker options so we
# cannot just pass the convience library names through
- # without $wl, if we do not link with $LD.
+ # without $wl, iff we do not link with $LD.
# Luckily, gcc supports the same syntax we need for Sun Studio.
# Supported since Solaris 2.6 (maybe 2.5.1?)
case $wlarc in
/// getNaN - Factory for QNaN values.
///
- /// \param Negative - True if the NaN generated should be negative.
+ /// \param Negative - True iff the NaN generated should be negative.
/// \param type - The unspecified fill bits for creating the NaN, 0 by
/// default. The value is truncated as necessary.
static APFloat getNaN(const fltSemantics &Sem, bool Negative = false,
/// getLargest - Returns the largest finite number in the given
/// semantics.
///
- /// \param Negative - True if the number should be negative
+ /// \param Negative - True iff the number should be negative
static APFloat getLargest(const fltSemantics &Sem, bool Negative = false);
/// getSmallest - Returns the smallest (by magnitude) finite number
/// in the given semantics. Might be denormalized, which implies a
/// relative loss of precision.
///
- /// \param Negative - True if the number should be negative
+ /// \param Negative - True iff the number should be negative
static APFloat getSmallest(const fltSemantics &Sem, bool Negative = false);
/// getSmallestNormalized - Returns the smallest (by magnitude)
/// normalized finite number in the given semantics.
///
- /// \param Negative - True if the number should be negative
+ /// \param Negative - True iff the number should be negative
static APFloat getSmallestNormalized(const fltSemantics &Sem,
bool Negative = false);
return vector_[n];
}
- /// @returns true if the element was inserted into the SetVector.
+ /// @returns true iff the element was inserted into the SetVector.
/// @brief Insert a new element into the SetVector.
bool insert(const value_type &X) {
bool result = set_.insert(X);
return false;
}
- // Return true if all bits set in this SparseBitVector are
+ // Return true iff all bits set in this SparseBitVector are
// also set in RHS.
bool contains(const SparseBitVector<ElementSize> &RHS) const {
SparseBitVector<ElementSize> Result(*this);
DomTreeNodeBase<NodeT> *getRootNode() { return RootNode; }
const DomTreeNodeBase<NodeT> *getRootNode() const { return RootNode; }
- /// properlyDominates - Returns true if this dominates N and this != N.
+ /// properlyDominates - Returns true iff this dominates N and this != N.
/// Note that this is not a constant time operation!
///
bool properlyDominates(const DomTreeNodeBase<NodeT> *A,
return A;
}
- /// dominates - Returns true if A dominates B. Note that this is not a
+ /// dominates - Returns true iff A dominates B. Note that this is not a
/// constant time operation!
///
inline bool dominates(const DomTreeNodeBase<NodeT> *A,
/// pointer is the result of a call to "__error()".
///
/// Locations can also be defined in a constant-sensitive way. For example,
- /// it is possible to define a location that returns true if it is passed
+ /// it is possible to define a location that returns true iff it is passed
/// into the call as a specific argument. This is useful for modeling things
/// like "printf", which can store to memory, but only through pointers passed
/// with a '%n' constraint.
const SCEV *LHS, const SCEV *RHS);
/// SimplifyICmpOperands - Simplify LHS and RHS in a comparison with
- /// predicate Pred. Return true if any changes were made. If the
+ /// predicate Pred. Return true iff any changes were made. If the
/// operands are provably equal or inequal, LHS and RHS are set to
/// the same value and Pred is set to either ICMP_EQ or ICMP_NE.
///
/// an expressions A+B*x where A and B are loop invariant values.
bool isAffine() const {
// We know that the start value is invariant. This expression is thus
- // affine if the step is also invariant.
+ // affine iff the step is also invariant.
return getNumOperands() == 2;
}
/// @brief Get the data content of the archive member
const char* getData() const { return data; }
- /// @returns true if the member is a SVR4 (non-LLVM) symbol table
+ /// @returns true iff the member is a SVR4 (non-LLVM) symbol table
/// @brief Determine if this member is a SVR4 symbol table.
bool isSVR4SymbolTable() const { return flags&SVR4SymbolTableFlag; }
- /// @returns true if the member is a BSD4.4 (non-LLVM) symbol table
+ /// @returns true iff the member is a BSD4.4 (non-LLVM) symbol table
/// @brief Determine if this member is a BSD4.4 symbol table.
bool isBSD4SymbolTable() const { return flags&BSD4SymbolTableFlag; }
- /// @returns true if the archive member is the LLVM symbol table
+ /// @returns true iff the archive member is the LLVM symbol table
/// @brief Determine if this member is the LLVM symbol table.
bool isLLVMSymbolTable() const { return flags&LLVMSymbolTableFlag; }
- /// @returns true if the archive member is the ar(1) string table
+ /// @returns true iff the archive member is the ar(1) string table
/// @brief Determine if this member is the ar(1) string table.
bool isStringTable() const { return flags&StringTableFlag; }
- /// @returns true if the archive member is a bitcode file.
+ /// @returns true iff the archive member is a bitcode file.
/// @brief Determine if this member is a bitcode file.
bool isBitcode() const { return flags&BitcodeFlag; }
- /// @returns true if the file name contains a path (directory) component.
+ /// @returns true iff the file name contains a path (directory) component.
/// @brief Determine if the member has a path
bool hasPath() const { return flags&HasPathFlag; }
/// separator character (/). To avoid this, a "long format" member name is
/// allowed that doesn't have this restriction. This method determines if
/// that "long format" is used for this member.
- /// @returns true if the file name uses the long form
+ /// @returns true iff the file name uses the long form
/// @brief Determine if the member has a long file name
bool hasLongFilename() const { return flags&HasLongFilenameFlag; }
MachineFunction *MF;
MachineRegisterInfo *RegInfo;
BranchProbabilityInfo *BPI;
- /// CanLowerReturn - true if the function's return value can be lowered to
+ /// CanLowerReturn - true iff the function's return value can be lowered to
/// registers.
bool CanLowerReturn;
/// condition code in op #4, a CondCodeSDNode.
SELECT_CC,
- /// SetCC operator - This evaluates to a true value if the condition is
+ /// SetCC operator - This evaluates to a true value iff the condition is
/// true. If the result value type is not i1 then the high bits conform
/// to getBooleanContents. The operands to this are the left and right
/// operands to compare (ops #0, and #1) and the condition code to compare
// Return a probability as a fraction between 0 (0% probability) and
// 1 (100% probability), however the value is never equal to 0, and can be 1
- // only if SRC block has only one successor.
+ // only iff SRC block has only one successor.
// NB: This routine's complexity is linear on the number of successors of
// Src. Querying sequentially for each successor's probability is a quadratic
// query pattern.
MachineBasicBlock *Dst) const;
// Print value between 0 (0% probability) and 1 (100% probability),
- // however the value is never equal to 0, and can be 1 only if SRC block
+ // however the value is never equal to 0, and can be 1 only iff SRC block
// has only one successor.
raw_ostream &printEdgeProbability(raw_ostream &OS, MachineBasicBlock *Src,
MachineBasicBlock *Dst) const;
/// ISD::ADD with a ConstantSDNode on the right-hand side, or if it is an
/// ISD::OR with a ConstantSDNode that is guaranteed to have the same
/// semantics as an ADD. This handles the equivalence:
- /// X|Cst == X+Cst if X&Cst = 0.
+ /// X|Cst == X+Cst iff X&Cst = 0.
bool isBaseWithConstantOffset(SDValue Op) const;
/// isKnownNeverNan - Test whether the given SDValue is known to never be NaN.
return Val == 1;
}
- /// This function will return true if every bit in this constant is set
+ /// This function will return true iff every bit in this constant is set
/// to true.
- /// @returns true if this constant's bits are all set to true.
+ /// @returns true iff this constant's bits are all set to true.
/// @brief Determine if the value is all ones.
bool isMinusOne() const {
return Val.isAllOnesValue();
}
- /// This function will return true if this constant represents the largest
+ /// This function will return true iff this constant represents the largest
/// value that may be represented by the constant's type.
- /// @returns true if this is the largest value that may be represented
+ /// @returns true iff this is the largest value that may be represented
/// by this type.
/// @brief Determine if the value is maximal.
bool isMaxValue(bool isSigned) const {
return Val.isMaxValue();
}
- /// This function will return true if this constant represents the smallest
+ /// This function will return true iff this constant represents the smallest
/// value that may be represented by this constant's type.
/// @returns true if this is the smallest value that may be represented by
/// this type.
return Val.isMinValue();
}
- /// This function will return true if this constant represents a value with
+ /// This function will return true iff this constant represents a value with
/// active bits bigger than 64 bits or a value greater than the given uint64_t
/// value.
- /// @returns true if this constant is greater or equal to the given number.
+ /// @returns true iff this constant is greater or equal to the given number.
/// @brief Determine if the value is greater or equal to the given number.
bool uge(uint64_t Num) const {
return Val.getActiveBits() > 64 || Val.getZExtValue() >= Num;
/// There are several places where we need to know if a cast instruction
/// only deals with integer source and destination types. To simplify that
/// logic, this method is provided.
- /// @returns true if the cast has only integral typed operand and dest type.
+ /// @returns true iff the cast has only integral typed operand and dest type.
/// @brief Determine if this is an integer-only cast.
bool isIntegerCast() const;
/// A lossless cast is one that does not alter the basic value. It implies
/// a no-op cast but is more stringent, preventing things like int->float,
/// long->double, or int->ptr.
- /// @returns true if the cast is lossless.
+ /// @returns true iff the cast is lossless.
/// @brief Determine if this is a lossless cast.
bool isLosslessCast() const;
/// This method can be used to determine if a cast from S to DstTy using
/// Opcode op is valid or not.
- /// @returns true if the proposed cast is valid.
+ /// @returns true iff the proposed cast is valid.
/// @brief Determine if a cast is valid without creating one.
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy);
void setPreservesAll() { PreservesAll = true; }
bool getPreservesAll() const { return PreservesAll; }
- /// setPreservesCFG - This function should be called by the pass, if they do
+ /// setPreservesCFG - This function should be called by the pass, iff they do
/// not:
///
/// 1. Add or remove basic blocks from the function
/// determine if the current value of \p this is a syntactically valid
/// path name for the operating system. The path name does not need to
/// exist, validity is simply syntactical. Empty paths are always invalid.
- /// @returns true if the path name is syntactically legal for the
+ /// @returns true iff the path name is syntactically legal for the
/// host operating system.
/// @brief Determine if a path is syntactically valid or not.
bool isValid() const;
/// if the file is empty. To get the length of the file itself, Use the
/// PathWithStatus::getFileStatus() method and then the getSize() method
/// on the returned FileStatus object.
- /// @returns true if the path is empty.
+ /// @returns true iff the path is empty.
/// @brief Determines if the path name is empty (invalid).
bool isEmpty() const { return path.empty(); }
}
/// Determine if \p this is less than \p that.
- /// @returns True if *this < that.
+ /// @returns True iff *this < that.
/// @brief True if this < that.
int operator < (const TimeValue &that) const { return that > *this; }
/// Determine if \p this is greather than \p that.
- /// @returns True if *this > that.
+ /// @returns True iff *this > that.
/// @brief True if this > that.
int operator > (const TimeValue &that) const {
if ( this->seconds_ > that.seconds_ ) {
}
/// Determine if \p this is less than or equal to \p that.
- /// @returns True if *this <= that.
+ /// @returns True iff *this <= that.
/// @brief True if this <= that.
int operator <= (const TimeValue &that) const { return that >= *this; }
/// Determine if \p this is greater than or equal to \p that.
- /// @returns True if *this >= that.
+ /// @returns True iff *this >= that.
int operator >= (const TimeValue &that) const {
if ( this->seconds_ > that.seconds_ ) {
return 1;
}
/// Determines if two TimeValue objects represent the same moment in time.
- /// @returns True if *this == that.
+ /// @returns True iff *this == that.
int operator == (const TimeValue &that) const {
return (this->seconds_ == that.seconds_) &&
(this->nanos_ == that.nanos_);
/// Determines if two TimeValue objects represent times that are not the
/// same.
- /// @returns True if *this != that.
+ /// @returns True iff *this != that.
int operator != (const TimeValue &that) const { return !(*this == that); }
/// Adds two TimeValue objects together.
private:
/// isSizedDerivedType - Derived types like structures and arrays are sized
- /// if all of the members of the type are sized as well. Since asking for
+ /// iff all of the members of the type are sized as well. Since asking for
/// their size is relatively uncommon, move this operation out of line.
bool isSizedDerivedType() const;
};
/// @brief Lookup a named Value.
Value *lookup(StringRef Name) const { return vmap.lookup(Name); }
- /// @returns true if the symbol table is empty
+ /// @returns true iff the symbol table is empty
/// @brief Determine if the symbol table is empty
inline bool empty() const { return vmap.empty(); }
// LHS >u RHS.
case ICmpInst::ICMP_UGT:
case ICmpInst::ICMP_UGE:
- // Comparison is true if the LHS <s 0.
+ // Comparison is true iff the LHS <s 0.
if (MaxRecurse)
if (Value *V = SimplifyICmpInst(ICmpInst::ICMP_SLT, SrcOp,
Constant::getNullValue(SrcTy),
break;
case ICmpInst::ICMP_ULT:
case ICmpInst::ICMP_ULE:
- // Comparison is true if the LHS >=s 0.
+ // Comparison is true iff the LHS >=s 0.
if (MaxRecurse)
if (Value *V = SimplifyICmpInst(ICmpInst::ICMP_SGE, SrcOp,
Constant::getNullValue(SrcTy),
// Simplify comparisons involving max/min.
Value *A, *B;
CmpInst::Predicate P = CmpInst::BAD_ICMP_PREDICATE;
- CmpInst::Predicate EqP; // Chosen so that "A == max/min(A,B)" if "A EqP B".
+ CmpInst::Predicate EqP; // Chosen so that "A == max/min(A,B)" iff "A EqP B".
// Signed variants on "max(a,b)>=a -> true".
if (match(LHS, m_SMax(m_Value(A), m_Value(B))) && (A == RHS || B == RHS)) {
if (A != RHS) std::swap(A, B); // smax(A, B) pred A.
- EqP = CmpInst::ICMP_SGE; // "A == smax(A, B)" if "A sge B".
+ EqP = CmpInst::ICMP_SGE; // "A == smax(A, B)" iff "A sge B".
// We analyze this as smax(A, B) pred A.
P = Pred;
} else if (match(RHS, m_SMax(m_Value(A), m_Value(B))) &&
(A == LHS || B == LHS)) {
if (A != LHS) std::swap(A, B); // A pred smax(A, B).
- EqP = CmpInst::ICMP_SGE; // "A == smax(A, B)" if "A sge B".
+ EqP = CmpInst::ICMP_SGE; // "A == smax(A, B)" iff "A sge B".
// We analyze this as smax(A, B) swapped-pred A.
P = CmpInst::getSwappedPredicate(Pred);
} else if (match(LHS, m_SMin(m_Value(A), m_Value(B))) &&
(A == RHS || B == RHS)) {
if (A != RHS) std::swap(A, B); // smin(A, B) pred A.
- EqP = CmpInst::ICMP_SLE; // "A == smin(A, B)" if "A sle B".
+ EqP = CmpInst::ICMP_SLE; // "A == smin(A, B)" iff "A sle B".
// We analyze this as smax(-A, -B) swapped-pred -A.
// Note that we do not need to actually form -A or -B thanks to EqP.
P = CmpInst::getSwappedPredicate(Pred);
} else if (match(RHS, m_SMin(m_Value(A), m_Value(B))) &&
(A == LHS || B == LHS)) {
if (A != LHS) std::swap(A, B); // A pred smin(A, B).
- EqP = CmpInst::ICMP_SLE; // "A == smin(A, B)" if "A sle B".
+ EqP = CmpInst::ICMP_SLE; // "A == smin(A, B)" iff "A sle B".
// We analyze this as smax(-A, -B) pred -A.
// Note that we do not need to actually form -A or -B thanks to EqP.
P = Pred;
P = CmpInst::BAD_ICMP_PREDICATE;
if (match(LHS, m_UMax(m_Value(A), m_Value(B))) && (A == RHS || B == RHS)) {
if (A != RHS) std::swap(A, B); // umax(A, B) pred A.
- EqP = CmpInst::ICMP_UGE; // "A == umax(A, B)" if "A uge B".
+ EqP = CmpInst::ICMP_UGE; // "A == umax(A, B)" iff "A uge B".
// We analyze this as umax(A, B) pred A.
P = Pred;
} else if (match(RHS, m_UMax(m_Value(A), m_Value(B))) &&
(A == LHS || B == LHS)) {
if (A != LHS) std::swap(A, B); // A pred umax(A, B).
- EqP = CmpInst::ICMP_UGE; // "A == umax(A, B)" if "A uge B".
+ EqP = CmpInst::ICMP_UGE; // "A == umax(A, B)" iff "A uge B".
// We analyze this as umax(A, B) swapped-pred A.
P = CmpInst::getSwappedPredicate(Pred);
} else if (match(LHS, m_UMin(m_Value(A), m_Value(B))) &&
(A == RHS || B == RHS)) {
if (A != RHS) std::swap(A, B); // umin(A, B) pred A.
- EqP = CmpInst::ICMP_ULE; // "A == umin(A, B)" if "A ule B".
+ EqP = CmpInst::ICMP_ULE; // "A == umin(A, B)" iff "A ule B".
// We analyze this as umax(-A, -B) swapped-pred -A.
// Note that we do not need to actually form -A or -B thanks to EqP.
P = CmpInst::getSwappedPredicate(Pred);
} else if (match(RHS, m_UMin(m_Value(A), m_Value(B))) &&
(A == LHS || B == LHS)) {
if (A != LHS) std::swap(A, B); // A pred umin(A, B).
- EqP = CmpInst::ICMP_ULE; // "A == umin(A, B)" if "A ule B".
+ EqP = CmpInst::ICMP_ULE; // "A == umin(A, B)" iff "A ule B".
// We analyze this as umax(-A, -B) pred -A.
// Note that we do not need to actually form -A or -B thanks to EqP.
P = Pred;
// isLoop - Find out if there is a back edge in this interval...
//
bool Interval::isLoop() const {
- // There is a loop in this interval if one of the predecessors of the header
+ // There is a loop in this interval iff one of the predecessors of the header
// node lives in the interval.
for (::pred_iterator I = ::pred_begin(HeaderNode), E = ::pred_end(HeaderNode);
I != E; ++I)
// If this is an equality comparison, we can try to fold it knowing that
// "V != C1".
if (Pred == ICmpInst::ICMP_EQ) {
- // !C1 == C -> false if C1 == C.
+ // !C1 == C -> false iff C1 == C.
Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE,
Result.getNotConstant(), C, TD,
TLI);
if (Res->isNullValue())
return False;
} else if (Pred == ICmpInst::ICMP_NE) {
- // !C1 != C -> true if C1 == C.
+ // !C1 != C -> true iff C1 == C.
Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE,
Result.getNotConstant(), C, TD,
TLI);
/// This form often exposes folding opportunities that are hidden in
/// the original operand list.
///
-/// Return true if it appears that any interesting folding opportunities
+/// Return true iff it appears that any interesting folding opportunities
/// may be exposed. This helps getAddRecExpr short-circuit extra work in
/// the common case where no interesting opportunities are present, and
/// is also used as a check to avoid infinite recursion.
}
/// SimplifyICmpOperands - Simplify LHS and RHS in a comparison with
-/// predicate Pred. Return true if any changes were made.
+/// predicate Pred. Return true iff any changes were made.
///
bool ScalarEvolution::SimplifyICmpOperands(ICmpInst::Predicate &Pred,
const SCEV *&LHS, const SCEV *&RHS,
return;
}
case Instruction::Shl:
- // (shl X, C1) & C2 == 0 if (X & C2 >>u C1) == 0
+ // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0
if (ConstantInt *SA = dyn_cast<ConstantInt>(I->getOperand(1))) {
uint64_t ShiftAmt = SA->getLimitedValue(BitWidth);
ComputeMaskedBits(I->getOperand(0), KnownZero, KnownOne, TD, Depth+1);
}
break;
case Instruction::LShr:
- // (ushr X, C1) & C2 == 0 if (-1 >> C1) & C2 == 0
+ // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0
if (ConstantInt *SA = dyn_cast<ConstantInt>(I->getOperand(1))) {
// Compute the new bits that are at the top now.
uint64_t ShiftAmt = SA->getLimitedValue(BitWidth);
}
break;
case Instruction::AShr:
- // (ashr X, C1) & C2 == 0 if (-1 >> C1) & C2 == 0
+ // (ashr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0
if (ConstantInt *SA = dyn_cast<ConstantInt>(I->getOperand(1))) {
// Compute the new bits that are at the top now.
uint64_t ShiftAmt = SA->getLimitedValue(BitWidth-1);
return DAG.getNode(Opc, DL, VT, N0.getOperand(0), OpNode);
}
if (N0.hasOneUse()) {
- // reassoc. (op (op x, c1), y) -> (op (op x, y), c1) if x+c1 has one use
+ // reassoc. (op (op x, c1), y) -> (op (op x, y), c1) iff x+c1 has one use
SDValue OpNode = DAG.getNode(Opc, N0.getDebugLoc(), VT,
N0.getOperand(0), N1);
AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, DL, VT, N1.getOperand(0), OpNode);
}
if (N1.hasOneUse()) {
- // reassoc. (op y, (op x, c1)) -> (op (op x, y), c1) if x+c1 has one use
+ // reassoc. (op y, (op x, c1)) -> (op (op x, y), c1) iff x+c1 has one use
SDValue OpNode = DAG.getNode(Opc, N0.getDebugLoc(), VT,
N1.getOperand(0), N0);
AddToWorkList(OpNode.getNode());
if (!VT.isVector() && SimplifyDemandedBits(SDValue(N, 0)))
return SDValue(N, 0);
- // fold (a+b) -> (a|b) if a and b share no bits.
+ // fold (a+b) -> (a|b) iff a and b share no bits.
if (VT.isInteger() && !VT.isVector()) {
APInt LHSZero, LHSOne;
APInt RHSZero, RHSOne;
return CombineTo(N, N0, DAG.getNode(ISD::CARRY_FALSE,
N->getDebugLoc(), MVT::Glue));
- // fold (addc a, b) -> (or a, b), CARRY_FALSE if a and b share no bits.
+ // fold (addc a, b) -> (or a, b), CARRY_FALSE iff a and b share no bits.
APInt LHSZero, LHSOne;
APInt RHSZero, RHSOne;
DAG.ComputeMaskedBits(N0, LHSZero, LHSOne);
return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0,
DAG.getConstant(N1C->getAPIntValue().logBase2(),
getShiftAmountTy(N0.getValueType())));
- // fold (udiv x, (shl c, y)) -> x >>u (log2(c)+y) if c is power of 2
+ // fold (udiv x, (shl c, y)) -> x >>u (log2(c)+y) iff c is power of 2
if (N1.getOpcode() == ISD::SHL) {
if (ConstantSDNode *SHC = dyn_cast<ConstantSDNode>(N1.getOperand(0))) {
if (SHC->getAPIntValue().isPowerOf2()) {
return SDValue(N, 0); // Return N so it doesn't get rechecked!
}
}
- // fold (zext_inreg (sextload x)) -> (zextload x) if load has one use
+ // fold (zext_inreg (sextload x)) -> (zextload x) iff load has one use
if (ISD::isSEXTLoad(N0.getNode()) && ISD::isUNINDEXEDLoad(N0.getNode()) &&
N0.hasOneUse()) {
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
// fold (or x, -1) -> -1
if (N1C && N1C->isAllOnesValue())
return N1;
- // fold (or x, c) -> c if (x & ~c) == 0
+ // fold (or x, c) -> c iff (x & ~c) == 0
if (N1C && DAG.MaskedValueIsZero(N0, ~N1C->getAPIntValue()))
return N1;
if (ROR.getNode() != 0)
return ROR;
// Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2)
- // if (c1 & c2) == 0.
+ // iff (c1 & c2) == 0.
if (N1C && N0.getOpcode() == ISD::AND && N0.getNode()->hasOneUse() &&
isa<ConstantSDNode>(N0.getOperand(1))) {
ConstantSDNode *C1 = cast<ConstantSDNode>(N0.getOperand(1));
return DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT, V);
}
- // fold (not (or x, y)) -> (and (not x), (not y)) if x or y are setcc
+ // fold (not (or x, y)) -> (and (not x), (not y)) iff x or y are setcc
if (N1C && N1C->getAPIntValue() == 1 && VT == MVT::i1 &&
(N0.getOpcode() == ISD::OR || N0.getOpcode() == ISD::AND)) {
SDValue LHS = N0.getOperand(0), RHS = N0.getOperand(1);
return DAG.getNode(NewOpcode, N->getDebugLoc(), VT, LHS, RHS);
}
}
- // fold (not (or x, y)) -> (and (not x), (not y)) if x or y are constants
+ // fold (not (or x, y)) -> (and (not x), (not y)) iff x or y are constants
if (N1C && N1C->isAllOnesValue() &&
(N0.getOpcode() == ISD::OR || N0.getOpcode() == ISD::AND)) {
SDValue LHS = N0.getOperand(0), RHS = N0.getOperand(1);
return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0.getOperand(0), N1);
}
- // fold (srl (ctlz x), "5") -> x if x has one bit set (the low bit).
+ // fold (srl (ctlz x), "5") -> x iff x has one bit set (the low bit).
if (N1C && N0.getOpcode() == ISD::CTLZ &&
N1C->getAPIntValue() == Log2_32(VT.getSizeInBits())) {
APInt KnownZero, KnownOne;
if (N0.getOpcode() == ISD::TRUNCATE) {
SDValue TruncOp = N0.getOperand(0);
if (TruncOp.getValueType() == VT)
- return TruncOp; // x if x size == zext size.
+ return TruncOp; // x iff x size == zext size.
if (TruncOp.getValueType().bitsGT(VT))
return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, TruncOp);
return DAG.getNode(ISD::ANY_EXTEND, N->getDebugLoc(), VT, TruncOp);
return NarrowLoad;
// fold (sext_in_reg (srl X, 24), i8) -> (sra X, 24)
- // fold (sext_in_reg (srl X, 23), i8) -> (sra X, 23) if possible.
+ // fold (sext_in_reg (srl X, 23), i8) -> (sra X, 23) iff possible.
// We already fold "(sext_in_reg (srl X, 25), i8) -> srl X, 25" above.
if (N0.getOpcode() == ISD::SRL) {
if (ConstantSDNode *ShAmt = dyn_cast<ConstantSDNode>(N0.getOperand(1)))
if (ShAmt->getZExtValue()+EVTBits <= VTBits) {
- // We can turn this into an SRA if the input to the SRL is already sign
+ // We can turn this into an SRA iff the input to the SRL is already sign
// extended enough.
unsigned InSignBits = DAG.ComputeNumSignBits(N0.getOperand(0));
if (VTBits-(ShAmt->getZExtValue()+EVTBits) < InSignBits)
CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
return SDValue(N, 0); // Return N so it doesn't get rechecked!
}
- // fold (sext_inreg (zextload x)) -> (sextload x) if load has one use
+ // fold (sext_inreg (zextload x)) -> (sextload x) iff load has one use
if (ISD::isZEXTLoad(N0.getNode()) && ISD::isUNINDEXEDLoad(N0.getNode()) &&
N0.hasOneUse() &&
EVT == cast<LoadSDNode>(N0)->getMemoryVT() &&
}
}
- // bitconvert(build_pair(ld, ld)) -> ld if load locations are consecutive.
+ // bitconvert(build_pair(ld, ld)) -> ld iff load locations are consecutive.
if (N0.getOpcode() == ISD::BUILD_PAIR) {
SDValue CombineLD = CombineConsecutiveLoads(N0.getNode(), VT);
if (CombineLD.getNode())
if (N1CFP) {
const APFloat& V = N1CFP->getValueAPF();
- // copysign(x, c1) -> fabs(x) if ispos(c1)
- // copysign(x, c1) -> fneg(fabs(x)) if isneg(c1)
+ // copysign(x, c1) -> fabs(x) iff ispos(c1)
+ // copysign(x, c1) -> fneg(fabs(x)) iff isneg(c1)
if (!V.isNegative()) {
if (!LegalOperations || TLI.isOperationLegal(ISD::FABS, VT))
return DAG.getNode(ISD::FABS, N->getDebugLoc(), VT, N0);
EVT XType = N0.getValueType();
EVT AType = N2.getValueType();
if (XType.bitsGE(AType)) {
- // and (sra X, size(X)-1, A) -> "and (srl X, C2), A" if A is a
+ // and (sra X, size(X)-1, A) -> "and (srl X, C2), A" iff A is a
// single-bit constant.
if (N2C && ((N2C->getAPIntValue() & (N2C->getAPIntValue()-1)) == 0)) {
unsigned ShCtV = N2C->getAPIntValue().logBase2();
if (ResNo == 1)
return PromoteIntRes_Overflow(N);
- // The operation overflowed if the result in the larger type is not the
+ // The operation overflowed iff the result in the larger type is not the
// sign extension of its truncation to the original type.
SDValue LHS = SExtPromotedInteger(N->getOperand(0));
SDValue RHS = SExtPromotedInteger(N->getOperand(1));
if (ResNo == 1)
return PromoteIntRes_Overflow(N);
- // The operation overflowed if the result in the larger type is not the
+ // The operation overflowed iff the result in the larger type is not the
// zero extension of its truncation to the original type.
SDValue LHS = ZExtPromotedInteger(N->getOperand(0));
SDValue RHS = ZExtPromotedInteger(N->getOperand(1));
}
SDValue Mul = DAG.getNode(ISD::MUL, DL, LHS.getValueType(), LHS, RHS);
- // Overflow occurred if the high part of the result does not
+ // Overflow occurred iff the high part of the result does not
// zero/sign-extend the low part.
SDValue Overflow;
if (N->getOpcode() == ISD::UMULO) {
- // Unsigned overflow occurred if the high part is non-zero.
+ // Unsigned overflow occurred iff the high part is non-zero.
SDValue Hi = DAG.getNode(ISD::SRL, DL, Mul.getValueType(), Mul,
DAG.getIntPtrConstant(SmallVT.getSizeInBits()));
Overflow = DAG.getSetCC(DL, N->getValueType(1), Hi,
DAG.getConstant(0, Hi.getValueType()), ISD::SETNE);
} else {
- // Signed overflow occurred if the high part does not sign extend the low.
+ // Signed overflow occurred iff the high part does not sign extend the low.
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, Mul.getValueType(),
Mul, DAG.getValueType(SmallVT));
Overflow = DAG.getSetCC(DL, N->getValueType(1), SExt, Mul, ISD::SETNE);
LHS, RHS);
SplitInteger(Sum, Lo, Hi);
- // Calculate the overflow: addition overflows if a + b < a, and subtraction
- // overflows if a - b > a.
+ // Calculate the overflow: addition overflows iff a + b < a, and subtraction
+ // overflows iff a - b > a.
SDValue Ofl = DAG.getSetCC(dl, N->getValueType(1), Sum, LHS,
N->getOpcode () == ISD::UADDO ?
ISD::SETULT : ISD::SETUGT);
KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1);
return;
case ISD::SHL:
- // (shl X, C1) & C2 == 0 if (X & C2 >>u C1) == 0
+ // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0
if (ConstantSDNode *SA = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
unsigned ShAmt = SA->getZExtValue();
}
return;
case ISD::SRL:
- // (ushr X, C1) & C2 == 0 if (-1 >> C1) & C2 == 0
+ // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0
if (ConstantSDNode *SA = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
unsigned ShAmt = SA->getZExtValue();
/// ISD::ADD with a ConstantSDNode on the right-hand side, or if it is an
/// ISD::OR with a ConstantSDNode that is guaranteed to have the same
/// semantics as an ADD. This handles the equivalence:
-/// X|Cst == X+Cst if X&Cst = 0.
+/// X|Cst == X+Cst iff X&Cst = 0.
bool SelectionDAG::isBaseWithConstantOffset(SDValue Op) const {
if ((Op.getOpcode() != ISD::ADD && Op.getOpcode() != ISD::OR) ||
!isa<ConstantSDNode>(Op.getOperand(1)))
assert(VT.isFloatingPoint() && EVT.isFloatingPoint() &&
"Cannot FP_ROUND_INREG integer types");
assert(EVT.isVector() == VT.isVector() &&
- "FP_ROUND_INREG type should be vector if the operand "
+ "FP_ROUND_INREG type should be vector iff the operand "
"type is vector!");
assert((!EVT.isVector() ||
EVT.getVectorNumElements() == VT.getVectorNumElements()) &&
assert(VT.isInteger() && EVT.isInteger() &&
"Cannot *_EXTEND_INREG FP types");
assert(EVT.isVector() == VT.isVector() &&
- "SIGN_EXTEND_INREG type should be vector if the operand "
+ "SIGN_EXTEND_INREG type should be vector iff the operand "
"type is vector!");
assert((!EVT.isVector() ||
EVT.getVectorNumElements() == VT.getVectorNumElements()) &&
// If all of the unknown bits are known to be zero on one side or the other
// (but not both) turn this into an *inclusive* or.
- // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) if C1&C2 == 0
+ // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
if ((NewMask & ~KnownZero & ~KnownZero2) == 0)
return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, dl, Op.getValueType(),
Op.getOperand(0),
// If all of the demanded bits on one side are known, and all of the set
// bits on that side are also known to be set on the other side, turn this
// into an AND, as we know the bits will be cleared.
- // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 if (C1&C2) == C2
+ // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2
// NB: it is okay if more bits are known than are requested
if ((NewMask & (KnownZero|KnownOne)) == NewMask) { // all known on one side
if (KnownOne == KnownOne2) { // set bits are the same on both sides
return DAG.getSetCC(dl, VT, And, DAG.getConstant(0, CTVT), CC);
}
- // TODO: (ctpop x) == 1 -> x && (x & x-1) == 0 if ctpop is illegal.
+ // TODO: (ctpop x) == 1 -> x && (x & x-1) == 0 iff ctpop is illegal.
}
// (zext x) == C --> x == (trunc C)
N0.getValueType()), Cond);
}
- // Turn (X^C1) == C2 into X == C1^C2 if X&~C1 = 0.
+ // Turn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0.
if (N0.getOpcode() == ISD::XOR)
// If we know that all of the inverted bits are zero, don't bother
// performing the inversion.
return Data.size();
}
-/// Add String to the table if it is not already there.
+/// Add String to the table iff it is not already there.
/// @returns the index into the string table where the string is now located.
size_t StringTable::insert(llvm::StringRef String) {
map::iterator i = Map.find(String);
// 0 / X ===> 0
return APInt(BitWidth, 0);
else if (lhsWords < rhsWords || this->ult(RHS)) {
- // X / Y ===> 0, if X < Y
+ // X / Y ===> 0, iff X < Y
return APInt(BitWidth, 0);
} else if (*this == RHS) {
// X / X ===> 1
// 0 % Y ===> 0
return APInt(BitWidth, 0);
} else if (lhsWords < rhsWords || this->ult(RHS)) {
- // X % Y ===> X, if X < Y
+ // X % Y ===> X, iff X < Y
return *this;
} else if (*this == RHS) {
// X % X == 0;
}
if (lhsWords < rhsWords || LHS.ult(RHS)) {
- Remainder = LHS; // X % Y ===> X, if X < Y
- Quotient = 0; // X / Y ===> 0, if X < Y
+ Remainder = LHS; // X % Y ===> X, iff X < Y
+ Quotient = 0; // X / Y ===> 0, iff X < Y
return;
}
}
-// Print information when destroyed, if command line option is specified.
+// Print information when destroyed, iff command line option is specified.
StatisticInfo::~StatisticInfo() {
llvm::PrintStatistics();
}
if (TII.isPredicable(MI) || isARMNEONPred(MI))
AddDefaultPred(MIB);
- // Do we optionally set a predicate? Preds is size > 0 if the predicate
+ // Do we optionally set a predicate? Preds is size > 0 iff the predicate
// defines CPSR. All other OptionalDefines in ARM are the CCR register.
bool CPSR = false;
if (DefinesOptionalPredicate(MI, &CPSR)) {
if (N->getOpcode() == ISD::AND) {
if (isOpcWithIntImmediate(N, ISD::AND, And_imm)) {
- // The immediate is a mask of the low bits if imm & (imm+1) == 0
+ // The immediate is a mask of the low bits iff imm & (imm+1) == 0
if (And_imm & (And_imm + 1))
return NULL;
if (!TM.Options.UseSoftFloat && Subtarget->hasVFP2() &&
!Subtarget->isThumb1Only()) {
// Turn f64->i64 into VMOVRRD, i64 -> f64 to VMOVDRR
- // if target supports vfp2.
+ // iff target supports vfp2.
setOperationAction(ISD::BITCAST, MVT::i64, Custom);
setOperationAction(ISD::FLT_ROUNDS_, MVT::i32, Custom);
}
DebugLoc DL = N->getDebugLoc();
// 1) or (and A, mask), val => ARMbfi A, val, mask
- // if (val & mask) == val
+ // iff (val & mask) == val
//
// 2) or (and A, mask), (and B, mask2) => ARMbfi A, (lsr B, amt), mask
- // 2a) if isBitFieldInvertedMask(mask) && isBitFieldInvertedMask(~mask2)
+ // 2a) iff isBitFieldInvertedMask(mask) && isBitFieldInvertedMask(~mask2)
// && mask == ~mask2
- // 2b) if isBitFieldInvertedMask(~mask) && isBitFieldInvertedMask(mask2)
+ // 2b) iff isBitFieldInvertedMask(~mask) && isBitFieldInvertedMask(mask2)
// && ~mask == mask2
// (i.e., copy a bitfield value into another bitfield of the same width)
}
// Writeback version is just a pseudo, as there's no encoding difference.
-// Writeback happens if the base register is not in the destination register
+// Writeback happens iff the base register is not in the destination register
// list.
def tLDMIA_UPD :
InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo, GenericDomain,
// instruction. We'll make the transformation in processInstruction()
// if necessary.
//
- // Thumb LDM instructions are writeback if the base register is not
+ // Thumb LDM instructions are writeback iff the base register is not
// in the register list.
unsigned Rn = Inst.getOperand(0).getReg();
bool hasWritebackToken =
Inst.addOperand(MCOperand::CreateReg(0)); // cc_out
break;
case ARM::tADDi8:
- // If the immediate is in the range 0-7, we want tADDi3 if Rd was
+ // If the immediate is in the range 0-7, we want tADDi3 iff Rd was
// explicitly specified. From the ARM ARM: "Encoding T1 is preferred
// to encoding T2 if <Rd> is specified and encoding T2 is preferred
// to encoding T1 if <Rd> is omitted."
}
break;
case ARM::tSUBi8:
- // If the immediate is in the range 0-7, we want tADDi3 if Rd was
+ // If the immediate is in the range 0-7, we want tADDi3 iff Rd was
// explicitly specified. From the ARM ARM: "Encoding T1 is preferred
// to encoding T2 if <Rd> is specified and encoding T2 is preferred
// to encoding T1 if <Rd> is omitted."
}
case ISD::OR:
- // Handle "X | C" as "X + C" if X is known to have C bits clear.
+ // Handle "X | C" as "X + C" iff X is known to have C bits clear.
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
MSP430ISelAddressMode Backup = AM;
uint64_t Offset = CN->getSExtValue();
return CurDAG->getTargetConstant(Imm, PPCLowering.getPointerTy());
}
- /// isRunOfOnes - Returns true if Val consists of one contiguous run of 1s
+ /// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s
/// with any number of 0s on either side. The 1s are allowed to wrap from
/// LSB to MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs.
/// 0x0F0F0000 is not, since all 1s are not contiguous.
}
/// handleCondMovFP - Handle two address conditional move instructions. These
-/// instructions move a st(i) register to st(0) if a condition is true. These
+/// instructions move a st(i) register to st(0) iff a condition is true. These
/// instructions require that the first operand is at the top of the stack, but
/// otherwise don't modify the stack at all.
void FPS::handleCondMovFP(MachineBasicBlock::iterator &I) {
}
case ISD::OR:
- // Handle "X | C" as "X + C" if X is known to have C bits clear.
+ // Handle "X | C" as "X + C" iff X is known to have C bits clear.
if (CurDAG->isBaseWithConstantOffset(N)) {
X86ISelAddressMode Backup = AM;
ConstantSDNode *CN = cast<ConstantSDNode>(N.getOperand(1));
Iter = I;
for (unsigned i = 0; i < 4; ++i) {
// If we make it to the beginning of the block, it's safe to clobber
- // EFLAGS if EFLAGS is not live-in.
+ // EFLAGS iff EFLAGS is not live-in.
if (Iter == B)
return !MBB.isLiveIn(X86::EFLAGS);
return DAG.getMergeValues(Ops, 2, dl);
}
- // fold (ladd x, 0, y) -> 0, add x, y if carry is unused and y has only the
+ // fold (ladd x, 0, y) -> 0, add x, y iff carry is unused and y has only the
// low bit set
if (N1C && N1C->isNullValue() && N->hasNUsesOfValue(0, 0)) {
APInt KnownZero, KnownOne;
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
EVT VT = N0.getValueType();
- // fold (lsub 0, 0, x) -> x, -x if x has only the low bit set
+ // fold (lsub 0, 0, x) -> x, -x iff x has only the low bit set
if (N0C && N0C->isNullValue() && N1C && N1C->isNullValue()) {
APInt KnownZero, KnownOne;
APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(),
}
}
- // fold (lsub x, 0, y) -> 0, sub x, y if borrow is unused and y has only the
+ // fold (lsub x, 0, y) -> 0, sub x, y iff borrow is unused and y has only the
// low bit set
if (N1C && N1C->isNullValue() && N->hasNUsesOfValue(0, 0)) {
APInt KnownZero, KnownOne;
// duplicate constants.
bool runOnModule(Module &M);
- // Return true if we can determine the alignment of this global variable.
+ // Return true iff we can determine the alignment of this global variable.
bool hasKnownAlignment(GlobalVariable *GV) const;
// Return the alignment of the global, including converting the default
return (AtomicOrdering)std::max(X, Y);
}
-/// SafeToDestroyConstant - It is safe to destroy a constant if it is only used
+/// SafeToDestroyConstant - It is safe to destroy a constant iff it is only used
/// by constants itself. Note that constants cannot be cyclic, so this test is
/// pretty easy to implement recursively.
///
//===----------------------------------------------------------------------===//
//
// This file implements a simple interprocedural pass which walks the
-// call-graph, turning invoke instructions into calls, if the callee cannot
+// call-graph, turning invoke instructions into calls, iff the callee cannot
// throw an exception, and marking functions 'nounwind' if they cannot throw.
// It implements this as a bottom-up traversal of the call-graph.
//
if (dyn_castFoldableMul(RHS, C2) == LHS)
return BinaryOperator::CreateMul(LHS, AddOne(C2));
- // A+B --> A|B if A and B have no bits set in common.
+ // A+B --> A|B iff A and B have no bits set in common.
if (IntegerType *IT = dyn_cast<IntegerType>(I.getType())) {
APInt LHSKnownOne(IT->getBitWidth(), 0);
APInt LHSKnownZero(IT->getBitWidth(), 0);
}
}
- // W*X + Y*Z --> W * (X+Z) if W == Y
+ // W*X + Y*Z --> W * (X+Z) iff W == Y
{
Value *W, *X, *Y, *Z;
if (match(LHS, m_Mul(m_Value(W), m_Value(X))) &&
return Builder->CreateICmpUGT(Add, LowerBound);
}
-// isRunOfOnes - Returns true if Val consists of one contiguous run of 1s with
+// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s with
// any number of 0s on either side. The 1s are allowed to wrap from LSB to
// MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs. 0x0F0F0000 is
// not, since all 1s are not contiguous.
/// where isSub determines whether the operator is a sub. If we can fold one of
/// the following xforms:
///
-/// ((A & N) +/- B) & Mask -> (A +/- B) & Mask if N&Mask == Mask
-/// ((A | N) +/- B) & Mask -> (A +/- B) & Mask if N&Mask == 0
-/// ((A ^ N) +/- B) & Mask -> (A +/- B) & Mask if N&Mask == 0
+/// ((A & N) +/- B) & Mask -> (A +/- B) & Mask iff N&Mask == Mask
+/// ((A | N) +/- B) & Mask -> (A +/- B) & Mask iff N&Mask == 0
+/// ((A ^ N) +/- B) & Mask -> (A +/- B) & Mask iff N&Mask == 0
///
/// return (A +/- B).
///
// (trunc x) == C1 & (and x, CA) == C2 -> (and x, CA|CMAX) == C1|C2
// where CMAX is the all ones value for the truncated type,
- // if the lower bits of C2 and CA are zero.
+ // iff the lower bits of C2 and CA are zero.
if (LHSCC == ICmpInst::ICMP_EQ && LHSCC == RHSCC &&
LHS->hasOneUse() && RHS->hasOneUse()) {
Value *V;
break;
}
case Instruction::Add:
- // ((A & N) + B) & AndRHS -> (A + B) & AndRHS if N&AndRHS == AndRHS.
- // ((A | N) + B) & AndRHS -> (A + B) & AndRHS if N&AndRHS == 0
- // ((A ^ N) + B) & AndRHS -> (A + B) & AndRHS if N&AndRHS == 0
+ // ((A & N) + B) & AndRHS -> (A + B) & AndRHS iff N&AndRHS == AndRHS.
+ // ((A | N) + B) & AndRHS -> (A + B) & AndRHS iff N&AndRHS == 0
+ // ((A ^ N) + B) & AndRHS -> (A + B) & AndRHS iff N&AndRHS == 0
if (Value *V = FoldLogicalPlusAnd(Op0LHS, Op0RHS, AndRHS, false, I))
return BinaryOperator::CreateAnd(V, AndRHS);
if (Value *V = FoldLogicalPlusAnd(Op0RHS, Op0LHS, AndRHS, false, I))
break;
case Instruction::Sub:
- // ((A & N) - B) & AndRHS -> (A - B) & AndRHS if N&AndRHS == AndRHS.
- // ((A | N) - B) & AndRHS -> (A - B) & AndRHS if N&AndRHS == 0
- // ((A ^ N) - B) & AndRHS -> (A - B) & AndRHS if N&AndRHS == 0
+ // ((A & N) - B) & AndRHS -> (A - B) & AndRHS iff N&AndRHS == AndRHS.
+ // ((A | N) - B) & AndRHS -> (A - B) & AndRHS iff N&AndRHS == 0
+ // ((A ^ N) - B) & AndRHS -> (A - B) & AndRHS iff N&AndRHS == 0
if (Value *V = FoldLogicalPlusAnd(Op0LHS, Op0RHS, AndRHS, true, I))
return BinaryOperator::CreateAnd(V, AndRHS);
- // (A - N) & AndRHS -> -N & AndRHS if A&AndRHS==0 and AndRHS
+ // (A - N) & AndRHS -> -N & AndRHS iff A&AndRHS==0 and AndRHS
// has 1's for all bits that the subtraction with A might affect.
if (Op0I->hasOneUse() && !match(Op0LHS, m_Zero())) {
uint32_t BitWidth = AndRHSMask.getBitWidth();
}
// (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA), C1)
- // if C2 + CA == C1.
+ // iff C2 + CA == C1.
if (LHSCC == ICmpInst::ICMP_ULT && RHSCC == ICmpInst::ICMP_EQ) {
ConstantInt *AddCst;
if (match(Val, m_Add(m_Specific(Val2), m_ConstantInt(AddCst))))
if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {
ConstantInt *C1 = 0; Value *X = 0;
// (X & C1) | C2 --> (X | C2) & (C1|C2)
- // if (C1 & C2) == 0.
+ // iff (C1 & C2) == 0.
if (match(Op0, m_And(m_Value(X), m_ConstantInt(C1))) &&
(RHS->getValue() & C1->getValue()) != 0 &&
Op0->hasOneUse()) {
return BSwap;
}
- // (X^C)|Y -> (X|Y)^C if Y&C == 0
+ // (X^C)|Y -> (X|Y)^C iff Y&C == 0
if (Op0->hasOneUse() &&
match(Op0, m_Xor(m_Value(A), m_ConstantInt(C1))) &&
MaskedValueIsZero(Op1, C1->getValue())) {
return BinaryOperator::CreateXor(NOr, C1);
}
- // Y|(X^C) -> (X|Y)^C if Y&C == 0
+ // Y|(X^C) -> (X|Y)^C iff Y&C == 0
if (Op1->hasOneUse() &&
match(Op1, m_Xor(m_Value(A), m_ConstantInt(C1))) &&
MaskedValueIsZero(Op0, C1->getValue())) {
if ((C1->getValue() & C2->getValue()) == 0) {
// ((V | N) & C1) | (V & C2) --> (V|N) & (C1|C2)
- // if (C1&C2) == 0 and (N&~C1) == 0
+ // iff (C1&C2) == 0 and (N&~C1) == 0
if (match(A, m_Or(m_Value(V1), m_Value(V2))) &&
((V1 == B && MaskedValueIsZero(V2, ~C1->getValue())) || // (V|N)
(V2 == B && MaskedValueIsZero(V1, ~C1->getValue())))) // (N|V)
C1->getValue()|C2->getValue()));
// ((V|C3)&C1) | ((V|C4)&C2) --> (V|C3|C4)&(C1|C2)
- // if (C1&C2) == 0 and (C3&~C1) == 0 and (C4&~C2) == 0.
+ // iff (C1&C2) == 0 and (C3&~C1) == 0 and (C4&~C2) == 0.
ConstantInt *C3 = 0, *C4 = 0;
if (match(A, m_Or(m_Value(V1), m_ConstantInt(C3))) &&
(C3->getValue() & ~C1->getValue()) == 0 &&
}
} else if (Op0I->getOpcode() == Instruction::Or) {
- // (X|C1)^C2 -> X^(C1|C2) if X&~C1 == 0
+ // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0
if (MaskedValueIsZero(Op0I->getOperand(0), Op0CI->getValue())) {
Constant *NewRHS = ConstantExpr::getOr(Op0CI, RHS);
// Anything in both C1 and C2 is known to be zero, remove it from
break;
case Instruction::LShr:
// If this is a truncate of a logical shr, we can truncate it to a smaller
- // lshr if we know that the bits we would otherwise be shifting in are
+ // lshr iff we know that the bits we would otherwise be shifting in are
// already zeros.
if (ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1))) {
uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
return ReplaceInstUsesWith(CI, In);
}
- // zext (X == 0) to i32 --> X^1 if X has only the low bit set.
- // zext (X == 0) to i32 --> (X>>1)^1 if X has only the 2nd bit set.
- // zext (X == 1) to i32 --> X if X has only the low bit set.
- // zext (X == 2) to i32 --> X>>1 if X has only the 2nd bit set.
- // zext (X != 0) to i32 --> X if X has only the low bit set.
- // zext (X != 0) to i32 --> X>>1 if X has only the 2nd bit set.
- // zext (X != 1) to i32 --> X^1 if X has only the low bit set.
- // zext (X != 2) to i32 --> (X>>1)^1 if X has only the 2nd bit set.
+ // zext (X == 0) to i32 --> X^1 iff X has only the low bit set.
+ // zext (X == 0) to i32 --> (X>>1)^1 iff X has only the 2nd bit set.
+ // zext (X == 1) to i32 --> X iff X has only the low bit set.
+ // zext (X == 2) to i32 --> X>>1 iff X has only the 2nd bit set.
+ // zext (X != 0) to i32 --> X iff X has only the low bit set.
+ // zext (X != 0) to i32 --> X>>1 iff X has only the 2nd bit set.
+ // zext (X != 1) to i32 --> X^1 iff X has only the low bit set.
+ // zext (X != 2) to i32 --> (X>>1)^1 iff X has only the 2nd bit set.
if ((Op1CV == 0 || Op1CV.isPowerOf2()) &&
// This only works for EQ and NE
ICI->isEquality()) {
LI.setAlignment(EffectiveLoadAlign);
}
- // load (cast X) --> cast (load X) if safe.
+ // load (cast X) --> cast (load X) iff safe.
if (isa<CastInst>(Op))
if (Instruction *Res = InstCombineLoadCast(*this, LI, TD))
return Res;
APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));
if (MaskedValueIsZero(Op0, Mask)) {
if (MaskedValueIsZero(Op1, Mask)) {
- // X sdiv Y -> X udiv Y, if X and Y don't have sign bit set
+ // X sdiv Y -> X udiv Y, iff X and Y don't have sign bit set
return BinaryOperator::CreateUDiv(Op0, Op1, I.getName());
}
if (I.getType()->isIntegerTy()) {
APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));
if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) {
- // X srem Y -> X urem Y, if X and Y don't have sign bit set
+ // X srem Y -> X urem Y, iff X and Y don't have sign bit set
return BinaryOperator::CreateURem(Op0, Op1, I.getName());
}
}
if (Instruction *Res = FoldShiftByConstant(Op0, CUI, I))
return Res;
- // X shift (A srem B) -> X shift (A and B-1) if B is a power of 2.
+ // X shift (A srem B) -> X shift (A and B-1) iff B is a power of 2.
// Because shifts by negative values (which could occur if A were negative)
// are undefined.
Value *A; const APInt *B;
// TODO: Check that the input bits are already zero with MaskedValueIsZero
#if 0
// If this is a truncate of a logical shr, we can truncate it to a smaller
- // lshr if we know that the bits we would otherwise be shifting in are
+ // lshr iff we know that the bits we would otherwise be shifting in are
// already zeros.
uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
uint32_t BitWidth = Ty->getScalarSizeInBits();
// If all of the demanded bits are known to be zero on one side or the
// other, turn this into an *inclusive* or.
- // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) if C1&C2 == 0
+ // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
if ((DemandedMask & ~RHSKnownZero & ~LHSKnownZero) == 0) {
Instruction *Or =
BinaryOperator::CreateOr(I->getOperand(0), I->getOperand(1),
// If all of the demanded bits on one side are known, and all of the set
// bits on that side are also known to be set on the other side, turn this
// into an AND, as we know the bits will be cleared.
- // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 if (C1&C2) == C2
+ // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2
if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) {
// all known
if ((RHSKnownOne & LHSKnownOne) == RHSKnownOne) {
continue;
// At this point we know that LFilter has at least one element.
if (isa<ConstantAggregateZero>(LFilter)) { // LFilter only contains zeros.
- // Filter is a subset of LFilter if Filter contains only zeros (as we
+ // Filter is a subset of LFilter iff Filter contains only zeros (as we
// already know that Filter is not longer than LFilter).
if (isa<ConstantAggregateZero>(Filter)) {
assert(FElts <= LElts && "Should have handled this case earlier!");
ConstantArray *LArray = cast<ConstantArray>(LFilter);
if (isa<ConstantAggregateZero>(Filter)) { // Filter only contains zeros.
// Since Filter is non-empty and contains only zeros, it is a subset of
- // LFilter if LFilter contains a zero.
+ // LFilter iff LFilter contains a zero.
assert(FElts > 0 && "Should have eliminated the empty filter earlier!");
for (unsigned l = 0; l != LElts; ++l)
if (LArray->getOperand(l)->isNullValue()) {
_increment = increment;
}
-// True if the edge has already been instrumented.
+// True iff the edge has already been instrumented.
bool BLInstrumentationEdge::hasInstrumentation() {
return(_hasInstrumentation);
}
break;
}
//case Instruction::Or:
- // TODO: We can handle "Or Val, Imm" if this OR is equivalent to an ADD.
+ // TODO: We can handle "Or Val, Imm" iff this OR is equivalent to an ADD.
//break;
case Instruction::Mul:
case Instruction::Shl: {
return I != E;
// If AllowIdenticalEdges is true, then we allow this edge to be considered
- // non-critical if all preds come from TI's block.
+ // non-critical iff all preds come from TI's block.
while (I != E) {
const BasicBlock *P = *I;
if (P != FirstPred)
// Now we have a map of all of the pairable instructions and we need to
// select the best possible pairing. A good pairing is one such that the
// users of the pair are also paired. This defines a (directed) forest
- // over the pairs such that two pairs are connected if the second pair
+ // over the pairs such that two pairs are connected iff the second pair
// uses the first.
// Note that it only matters that both members of the second pair use some
// . NormalDest
// .
//
- // Given the definition of dominance, NormalDest is dominated by X if X
+ // Given the definition of dominance, NormalDest is dominated by X iff X
// dominates all of NormalDest's predecessors (X, B, C in the example). X
// trivially dominates itself, so we only have to find if it dominates the
// other predecessors. Since the only way out of X is via NormalDest, X can
};
}
-// setPreservesCFG - This function should be called to by the pass, if they do
+// setPreservesCFG - This function should be called to by the pass, iff they do
// not:
//
// 1. Add or remove basic blocks from the function
void TimingInfo::createTheTimeInfo() {
if (!TimePassesIsEnabled || TheTimeInfo) return;
- // Constructed the first time this is called, if -time-passes is enabled.
+ // Constructed the first time this is called, iff -time-passes is enabled.
// This guarantees that the object will be constructed before static globals,
// thus it will be destroyed before them.
static ManagedStatic<TimingInfo> TTI;
}
/// isSizedDerivedType - Derived types like structures and arrays are sized
-/// if all of the members of the type are sized as well. Since asking for
+/// iff all of the members of the type are sized as well. Since asking for
/// their size is relatively uncommon, move this operation out of line.
bool Type::isSizedDerivedType() const {
if (this->isIntegerTy())
*)
# The compiler driver will combine linker options so we
# cannot just pass the convience library names through
- # without $wl, if we do not link with $LD.
+ # without $wl, iff we do not link with $LD.
# Luckily, gcc supports the same syntax we need for Sun Studio.
# Supported since Solaris 2.6 (maybe 2.5.1?)
case $wlarc in
; RUN: opt < %s -basicaa -gvn -asan -S | FileCheck %s
-; ASAN conflicts with load widening if the widened load accesses data out of bounds
+; ASAN conflicts with load widening iff the widened load accesses data out of bounds
; (while the original unwidened loads do not).
; http://code.google.com/p/address-sanitizer/issues/detail?id=20#c1
ret i32 %C
}
-; (A & C1)+(B & C2) -> (A & C1)|(B & C2) if C1&C2 == 0
+; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
define i32 @test8(i32 %A, i32 %B) {
%A1 = and i32 %A, 7 ; <i32> [#uses=1]
%B1 = and i32 %B, 128 ; <i32> [#uses=1]
define i47 @test1(i47 %A, i47 %B) {
- ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) if C1&C2 == 0
+ ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
%A1 = and i47 %A, 70368744177664
%B1 = and i47 %B, 70368744177661
%C1 = xor i47 %A1, %B1
}
define i47 @test7(i47 %A) {
- ;; (A | C1) ^ C2 -> (A | C1) & ~C2 if (C1&C2) == C2
+ ;; (A | C1) ^ C2 -> (A | C1) & ~C2 iff (C1&C2) == C2
%B1 = or i47 %A, 70368744177663
%C1 = xor i47 %B1, 703687463
ret i47 %C1
define i447 @test1(i447 %A, i447 %B) {
- ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) if C1&C2 == 0
+ ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
%A1 = and i447 %A, 70368744177664
%B1 = and i447 %B, 70368744177663
%C1 = xor i447 %A1, %B1
}
define i1023 @test7(i1023 %A) {
- ;; (A | C1) ^ C2 -> (A | C1) & ~C2 if (C1&C2) == C2
+ ;; (A | C1) ^ C2 -> (A | C1) & ~C2 iff (C1&C2) == C2
%B1 = or i1023 %A, 70368744177663
%C1 = xor i1023 %B1, 703687463
ret i1023 %C1
public:
ReducePassList(BugDriver &bd) : BD(bd) {}
- // doTest - Return true if running the "removed" passes succeeds, and
+ // doTest - Return true iff running the "removed" passes succeeds, and
// running the "Kept" passes fail when run on the output of the "removed"
// passes. If we return true, we update the current module of bugpoint.
//
#! /usr/bin/python
#this is a script to extract given named nodes from a dot file, with
-#the associated edges. An edge is kept if for edge x -> y
+#the associated edges. An edge is kept iff for edge x -> y
# x and y are both nodes specified to be kept.
#known issues: if a line contains '->' and is not an edge line
//
// Alternatively:
//
-// overlap(A, B) if there exists:
+// overlap(A, B) iff there exists:
// A' in { A, subregs(A) } and B' in { B, subregs(B) } such that:
// A' = B' or A' in aliases(B') or B' in aliases(A').
//
bool inheritRegUnits(CodeGenRegBank &RegBank);
// Adopt a register unit for pressure tracking.
- // A unit is adopted if its unit number is >= NumNativeRegUnits.
+ // A unit is adopted iff its unit number is >= NumNativeRegUnits.
void adoptRegUnit(unsigned RUID) { RegUnits.push_back(RUID); }
// Get the sum of this register's register unit weights.
// status_ok: true if exit_status is acceptable in the context of
// this particular death test, which fails if it is false
//
-// Returns true if all of the above conditions are met. Otherwise, the
+// Returns true iff all of the above conditions are met. Otherwise, the
// first failing condition, in the order given above, is the one that is
// reported. Also sets the last death test message string.
bool DeathTestImpl::Passed(bool status_ok) {
free(const_cast<char*>(pattern_));
}
-// Returns true if regular expression re matches the entire str.
+// Returns true iff regular expression re matches the entire str.
bool RE::FullMatch(const char* str, const RE& re) {
if (!re.is_valid_) return false;
return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
}
-// Returns true if regular expression re matches a substring of str
+// Returns true iff regular expression re matches a substring of str
// (including str itself).
bool RE::PartialMatch(const char* str, const RE& re) {
if (!re.is_valid_) return false;
#elif GTEST_USES_SIMPLE_RE
-// Returns true if ch appears anywhere in str (excluding the
+// Returns true iff ch appears anywhere in str (excluding the
// terminating '\0' character).
bool IsInSet(char ch, const char* str) {
return ch != '\0' && strchr(str, ch) != NULL;
}
-// Returns true if ch belongs to the given classification. Unlike
+// Returns true iff ch belongs to the given classification. Unlike
// similar functions in <ctype.h>, these aren't affected by the
// current locale.
bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
('0' <= ch && ch <= '9') || ch == '_';
}
-// Returns true if "\\c" is a supported escape sequence.
+// Returns true iff "\\c" is a supported escape sequence.
bool IsValidEscape(char c) {
return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW"));
}
-// Returns true if the given atom (specified by escaped and pattern)
+// Returns true iff the given atom (specified by escaped and pattern)
// matches ch. The result is undefined if the atom is invalid.
bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
if (escaped) { // "\\p" where p is pattern_char.
bool is_valid = true;
- // True if ?, *, or + can follow the previous atom.
+ // True iff ?, *, or + can follow the previous atom.
bool prev_repeatable = false;
for (int i = 0; regex[i]; i++) {
if (regex[i] == '\\') { // An escape sequence
return false;
}
-// Returns true if regex matches a prefix of str. regex must be a
+// Returns true iff regex matches a prefix of str. regex must be a
// valid simple regular expression and not start with "^", or the
// result is undefined.
bool MatchRegexAtHead(const char* regex, const char* str) {
}
}
-// Returns true if regex matches any substring of str. regex must be
+// Returns true iff regex matches any substring of str. regex must be
// a valid simple regular expression, or the result is undefined.
//
// The algorithm is recursive, but the recursion depth doesn't exceed
free(const_cast<char*>(full_pattern_));
}
-// Returns true if regular expression re matches the entire str.
+// Returns true iff regular expression re matches the entire str.
bool RE::FullMatch(const char* str, const RE& re) {
return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
}
-// Returns true if regular expression re matches a substring of str
+// Returns true iff regular expression re matches a substring of str
// (including str itself).
bool RE::PartialMatch(const char* str, const RE& re) {
return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
// Reads and returns the Boolean environment variable corresponding to
// the given flag; if it's not set, returns default_value.
//
-// The value is considered true if it's not "0".
+// The value is considered true iff it's not "0".
bool BoolFromGTestEnv(const char* flag, bool default_value) {
const String env_var = FlagToEnvVar(flag);
const char* const string_value = posix::GetEnv(env_var.c_str());
// stack trace.
const char kStackTraceMarker[] = "\nStack trace:\n";
-// g_help_flag is true if the --help flag or an equivalent form is
+// g_help_flag is true iff the --help flag or an equivalent form is
// specified on the command line.
bool g_help_flag = false;
GTEST_DEFINE_bool_(
break_on_failure,
internal::BoolFromGTestEnv("break_on_failure", false),
- "True if a failed assertion should be a debugger break-point.");
+ "True iff a failed assertion should be a debugger break-point.");
GTEST_DEFINE_bool_(
catch_exceptions,
internal::BoolFromGTestEnv("catch_exceptions", true),
- "True if " GTEST_NAME_
+ "True iff " GTEST_NAME_
" should catch exceptions and treat them as test failures.");
GTEST_DEFINE_string_(
GTEST_DEFINE_bool_(
print_time,
internal::BoolFromGTestEnv("print_time", true),
- "True if " GTEST_NAME_
+ "True iff " GTEST_NAME_
" should display elapsed time in text output.");
GTEST_DEFINE_int32_(
GTEST_DEFINE_bool_(
show_internal_stack_frames, false,
- "True if " GTEST_NAME_ " should include internal stack frames when "
+ "True iff " GTEST_NAME_ " should include internal stack frames when "
"printing test failure stack traces.");
GTEST_DEFINE_bool_(
shuffle,
internal::BoolFromGTestEnv("shuffle", false),
- "True if " GTEST_NAME_
+ "True iff " GTEST_NAME_
" should randomize tests' order on every run.");
GTEST_DEFINE_int32_(
return state_ % range;
}
-// GTestIsInitialized() returns true if the user has initialized
+// GTestIsInitialized() returns true iff the user has initialized
// Google Test. Useful for catching the user mistake of not initializing
// Google Test before calling RUN_ALL_TESTS().
//
return sum;
}
-// Returns true if the test case passed.
+// Returns true iff the test case passed.
static bool TestCasePassed(const TestCase* test_case) {
return test_case->should_run() && test_case->Passed();
}
-// Returns true if the test case failed.
+// Returns true iff the test case failed.
static bool TestCaseFailed(const TestCase* test_case) {
return test_case->should_run() && test_case->Failed();
}
-// Returns true if test_case contains at least one test that should
+// Returns true iff test_case contains at least one test that should
// run.
static bool ShouldRunTestCase(const TestCase* test_case) {
return test_case->should_run();
return result.ToString();
}
-// Returns true if the wildcard pattern matches the string. The
+// Returns true iff the wildcard pattern matches the string. The
// first ':' or '\0' character in pattern marks the end of it.
//
// This recursive algorithm isn't very efficient, but is clear and
// TODO(keithray): move String function implementations to gtest-string.cc.
-// Returns true if the user-specified filter matches the test case
+// Returns true iff the user-specified filter matches the test case
// name and the test name.
bool UnitTestOptions::FilterMatchesTest(const String &test_case_name,
const String &test_name) {
#endif // GTEST_OS_WINDOWS_MOBILE
-// Compares two C strings. Returns true if they have the same content.
+// Compares two C strings. Returns true iff they have the same content.
//
// Unlike strcmp(), this function can handle NULL argument(s). A NULL
// C string is considered different to any non-NULL C string,
// expected_value: "5"
// actual_value: "6"
//
-// The ignoring_case parameter is true if the assertion is a
+// The ignoring_case parameter is true iff the assertion is a
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
// be inserted into the message.
AssertionResult EqFailure(const char* expected_expression,
// Helper functions for implementing IsSubString() and IsNotSubstring().
-// This group of overloaded functions return true if needle is a
+// This group of overloaded functions return true iff needle is a
// substring of haystack. NULL is considered a substring of itself
// only.
String::ShowWideCString(wide_c_str).c_str());
}
-// Compares two wide C strings. Returns true if they have the same
+// Compares two wide C strings. Returns true iff they have the same
// content.
//
// Unlike wcscmp(), this function can handle NULL argument(s). A NULL
<< " vs " << String::ShowWideCStringQuoted(s2);
}
-// Compares two C strings, ignoring case. Returns true if they have
+// Compares two C strings, ignoring case. Returns true iff they have
// the same content.
//
// Unlike strcasecmp(), this function can handle NULL argument(s). A
return posix::StrCaseCmp(lhs, rhs) == 0;
}
- // Compares two wide C strings, ignoring case. Returns true if they
+ // Compares two wide C strings, ignoring case. Returns true iff they
// have the same content.
//
// Unlike wcscasecmp(), this function can handle NULL argument(s).
(length() > rhs.length()) ? 1 : 0;
}
-// Returns true if this String ends with the given suffix. *Any*
+// Returns true iff this String ends with the given suffix. *Any*
// String is considered to end with a NULL or empty suffix.
bool String::EndsWith(const char* suffix) const {
if (suffix == NULL || CStringEquals(suffix, "")) return true;
CStringEquals(c_str() + this_len - suffix_len, suffix);
}
-// Returns true if this String ends with the given suffix, ignoring case.
+// Returns true iff this String ends with the given suffix, ignoring case.
// Any String is considered to end with a NULL or empty suffix.
bool String::EndsWithCaseInsensitive(const char* suffix) const {
if (suffix == NULL || CStringEquals(suffix, "")) return true;
elapsed_time_ = 0;
}
-// Returns true if the test failed.
+// Returns true iff the test failed.
bool TestResult::Failed() const {
for (int i = 0; i < total_part_count(); ++i) {
if (GetTestPartResult(i).failed())
return false;
}
-// Returns true if the test part fatally failed.
+// Returns true iff the test part fatally failed.
static bool TestPartFatallyFailed(const TestPartResult& result) {
return result.fatally_failed();
}
-// Returns true if the test fatally failed.
+// Returns true iff the test fatally failed.
bool TestResult::HasFatalFailure() const {
return CountIf(test_part_results_, TestPartFatallyFailed) > 0;
}
-// Returns true if the test part non-fatally failed.
+// Returns true iff the test part non-fatally failed.
static bool TestPartNonfatallyFailed(const TestPartResult& result) {
return result.nonfatally_failed();
}
-// Returns true if the test has a non-fatal failure.
+// Returns true iff the test has a non-fatal failure.
bool TestResult::HasNonfatalFailure() const {
return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;
}
this, &Test::TearDown, "TearDown()");
}
-// Returns true if the current test has a fatal failure.
+// Returns true iff the current test has a fatal failure.
bool Test::HasFatalFailure() {
return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
}
-// Returns true if the current test has a non-fatal failure.
+// Returns true iff the current test has a non-fatal failure.
bool Test::HasNonfatalFailure() {
return internal::GetUnitTestImpl()->current_test_result()->
HasNonfatalFailure();
#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-// Returns true if Google Test should use colors in the output.
+// Returns true iff Google Test should use colors in the output.
bool ShouldUseColor(bool stdout_is_tty) {
const char* const gtest_color = GTEST_FLAG(color).c_str();
return impl()->elapsed_time();
}
-// Returns true if the unit test passed (i.e. all test cases passed).
+// Returns true iff the unit test passed (i.e. all test cases passed).
bool UnitTest::Passed() const { return impl()->Passed(); }
-// Returns true if the unit test failed (i.e. some test case failed
+// Returns true iff the unit test failed (i.e. some test case failed
// or something outside of all tests failed).
bool UnitTest::Failed() const { return impl()->Failed(); }
explicit TestCaseNameIs(const String& name)
: name_(name) {}
- // Returns true if the name of test_case matches name_.
+ // Returns true iff the name of test_case matches name_.
bool operator()(const TestCase* test_case) const {
return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;
}
// protocol.
internal::WriteToShardStatusFileIfNeeded();
- // True if we are in a subprocess for running a thread-safe-style
+ // True iff we are in a subprocess for running a thread-safe-style
// death test.
bool in_subprocess_for_death_test = false;
random_seed_ = GTEST_FLAG(shuffle) ?
GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
- // True if at least one test has failed.
+ // True iff at least one test has failed.
bool failed = false;
TestEventListener* repeater = listeners()->repeater();
}
// Given the total number of shards, the shard index, and the test id,
-// returns true if the test should be run on this shard. The test id is
+// returns true iff the test should be run on this shard. The test id is
// some arbitrary but unique non-negative integer assigned to each test
// method. Assumes that 0 <= shard_index < total_shards.
bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
// Gets the message associated with the test part.
const char* message() const { return message_.c_str(); }
- // Returns true if the test part passed.
+ // Returns true iff the test part passed.
bool passed() const { return type_ == kSuccess; }
- // Returns true if the test part failed.
+ // Returns true iff the test part failed.
bool failed() const { return type_ != kSuccess; }
- // Returns true if the test part non-fatally failed.
+ // Returns true iff the test part non-fatally failed.
bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
- // Returns true if the test part fatally failed.
+ // Returns true iff the test part fatally failed.
bool fatally_failed() const { return type_ == kFatalFailure; }
private:
Type type_;
// Used in the EXPECT_TRUE/FALSE(bool_expression).
explicit AssertionResult(bool success) : success_(success) {}
- // Returns true if the assertion succeeded.
+ // Returns true iff the assertion succeeded.
operator bool() const { return success_; } // NOLINT
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
// class.
static void TearDownTestCase() {}
- // Returns true if the current test has a fatal failure.
+ // Returns true iff the current test has a fatal failure.
static bool HasFatalFailure();
- // Returns true if the current test has a non-fatal failure.
+ // Returns true iff the current test has a non-fatal failure.
static bool HasNonfatalFailure();
- // Returns true if the current test has a (either fatal or
+ // Returns true iff the current test has a (either fatal or
// non-fatal) failure.
static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
virtual void TearDown();
private:
- // Returns true if the current test has the same fixture class as
+ // Returns true iff the current test has the same fixture class as
// the first test in the current test case.
static bool HasSameFixtureClass();
// Returns the number of the test properties.
int test_property_count() const;
- // Returns true if the test passed (i.e. no test part failed).
+ // Returns true iff the test passed (i.e. no test part failed).
bool Passed() const { return !Failed(); }
- // Returns true if the test failed.
+ // Returns true iff the test failed.
bool Failed() const;
- // Returns true if the test fatally failed.
+ // Returns true iff the test fatally failed.
bool HasFatalFailure() const;
- // Returns true if the test has a non-fatal failure.
+ // Returns true iff the test has a non-fatal failure.
bool HasNonfatalFailure() const;
// Returns the elapsed time, in milliseconds.
// value-parameterized test.
const internal::scoped_ptr<const ::std::string> value_param_;
const internal::TypeId fixture_class_id_; // ID of the test fixture class
- bool should_run_; // True if this test should run
- bool is_disabled_; // True if this test is disabled
+ bool should_run_; // True iff this test should run
+ bool is_disabled_; // True iff this test is disabled
bool matches_filter_; // True if this test matches the
// user-specified filter.
internal::TestFactoryBase* const factory_; // The factory that creates
// Gets the number of all tests in this test case.
int total_test_count() const;
- // Returns true if the test case passed.
+ // Returns true iff the test case passed.
bool Passed() const { return !Failed(); }
- // Returns true if the test case failed.
+ // Returns true iff the test case failed.
bool Failed() const { return failed_test_count() > 0; }
// Returns the elapsed time, in milliseconds.
// needed for catching exceptions thrown from TearDownTestCase().
void RunTearDownTestCase() { (*tear_down_tc_)(); }
- // Returns true if test passed.
+ // Returns true iff test passed.
static bool TestPassed(const TestInfo* test_info) {
return test_info->should_run() && test_info->result()->Passed();
}
- // Returns true if test failed.
+ // Returns true iff test failed.
static bool TestFailed(const TestInfo* test_info) {
return test_info->should_run() && test_info->result()->Failed();
}
- // Returns true if test is disabled.
+ // Returns true iff test is disabled.
static bool TestDisabled(const TestInfo* test_info) {
return test_info->is_disabled_;
}
Test::SetUpTestCaseFunc set_up_tc_;
// Pointer to the function that tears down the test case.
Test::TearDownTestCaseFunc tear_down_tc_;
- // True if any test in this test case should run.
+ // True iff any test in this test case should run.
bool should_run_;
// Elapsed time, in milliseconds.
TimeInMillis elapsed_time_;
// Gets the elapsed time, in milliseconds.
TimeInMillis elapsed_time() const;
- // Returns true if the unit test passed (i.e. all test cases passed).
+ // Returns true iff the unit test passed (i.e. all test cases passed).
bool Passed() const;
- // Returns true if the unit test failed (i.e. some test case failed
+ // Returns true iff the unit test failed (i.e. some test case failed
// or something outside of all tests failed).
bool Failed() const;
BiggestInt actual);
// The helper class for {ASSERT|EXPECT}_EQ. The template argument
-// lhs_is_null_literal is true if the first argument to ASSERT_EQ()
+// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
// is a null pointer literal. The following default implementation is
// for lhs_is_null_literal being false.
template <bool lhs_is_null_literal>
__FILE__, __LINE__, ::testing::Message() << (message))
// Compile-time assertion for type equality.
-// StaticAssertTypeEq<type1, type2>() compiles if type1 and type2 are
+// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
// the same type. The value it returns is not interesting.
//
// Instead of making StaticAssertTypeEq a class template, we make it a
// This macro is used for implementing macros such as
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
// death tests are not supported. Those macros must compile on such systems
-// if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
+// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
// systems that support death tests. This allows one to write such a macro
// on a system that does not support death tests and be sure that it will
// compile on a death-test supporting system.
// for program termination. This macro has to make sure this
// statement is compiled but not executed, to ensure that
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
-// parameter if EXPECT_DEATH compiles with it.
+// parameter iff EXPECT_DEATH compiles with it.
// regex - A regex that a macro such as EXPECT_DEATH would use to test
// the output of statement. This parameter has to be
// compiled but not evaluated by this macro, to ensure that
const FilePath& base_name,
const char* extension);
- // Returns true if the path is NULL or "".
+ // Returns true iff the path is NULL or "".
bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
// If input name has a trailing separator character, removes it and returns
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
#define GTEST_SRC_GTEST_INTERNAL_INL_H_
-// GTEST_IMPLEMENTATION_ is defined to 1 if the current translation unit is
+// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
// part of Google Test's implementation; otherwise it's undefined.
#if !GTEST_IMPLEMENTATION_
// A user is trying to include this from his code - just say no.
// A valid random seed must be in [1, kMaxRandomSeed].
const int kMaxRandomSeed = 99999;
-// g_help_flag is true if the --help flag or an equivalent form is
+// g_help_flag is true iff the --help flag or an equivalent form is
// specified on the command line.
GTEST_API_ extern bool g_help_flag;
// Returns the current time in milliseconds.
GTEST_API_ TimeInMillis GetTimeInMillis();
-// Returns true if Google Test should use colors in the output.
+// Returns true iff Google Test should use colors in the output.
GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
// Formats the given time in milliseconds as seconds.
GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
// Given the total number of shards, the shard index, and the test id,
-// returns true if the test should be run on this shard. The test id is
+// returns true iff the test should be run on this shard. The test id is
// some arbitrary but unique non-negative integer assigned to each test
// method. Assumes that 0 <= shard_index < total_shards.
GTEST_API_ bool ShouldRunTestOnShard(
explicit TestPropertyKeyIs(const char* key)
: key_(key) {}
- // Returns true if the test name of test property matches on key_.
+ // Returns true iff the test name of test property matches on key_.
bool operator()(const TestProperty& test_property) const {
return String(test_property.key()).Compare(key_) == 0;
}
// Functions for processing the gtest_filter flag.
- // Returns true if the wildcard pattern matches the string. The
+ // Returns true iff the wildcard pattern matches the string. The
// first ':' or '\0' character in pattern marks the end of it.
//
// This recursive algorithm isn't very efficient, but is clear and
// works well enough for matching test names, which are short.
static bool PatternMatchesString(const char *pattern, const char *str);
- // Returns true if the user-specified filter matches the test case
+ // Returns true iff the user-specified filter matches the test case
// name and the test name.
static bool FilterMatchesTest(const String &test_case_name,
const String &test_name);
// Gets the elapsed time, in milliseconds.
TimeInMillis elapsed_time() const { return elapsed_time_; }
- // Returns true if the unit test passed (i.e. all test cases passed).
+ // Returns true iff the unit test passed (i.e. all test cases passed).
bool Passed() const { return !Failed(); }
- // Returns true if the unit test failed (i.e. some test case failed
+ // Returns true iff the unit test failed (i.e. some test case failed
// or something outside of all tests failed).
bool Failed() const {
return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
// desired.
OsStackTraceGetterInterface* os_stack_trace_getter_;
- // True if PostFlagParsingInit() has been called.
+ // True iff PostFlagParsingInit() has been called.
bool post_flag_parse_init_performed_;
// The random number seed used at the beginning of the test run.
// expected_value: "5"
// actual_value: "6"
//
-// The ignoring_case parameter is true if the assertion is a
+// The ignoring_case parameter is true iff the assertion is a
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
// be inserted into the message.
GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
// Returns the sign bit of this number.
Bits sign_bit() const { return kSignBitMask & u_.bits_; }
- // Returns true if this is NAN (not a number).
+ // Returns true iff this is NAN (not a number).
bool is_nan() const {
// It's a NAN if the exponent bits are all ones and the fraction
// bits are not entirely zeros.
return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
}
- // Returns true if this number is at most kMaxUlps ULP's away from
+ // Returns true iff this number is at most kMaxUlps ULP's away from
// rhs. In particular, this function:
//
// - returns false if either number is (or both are) NAN.
};
// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
-// compiler error if T1 and T2 are different types.
+// compiler error iff T1 and T2 are different types.
template <typename T1, typename T2>
struct CompileAssertTypesEqual;
GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true if type From can be implicitly converted to
+// constant that's true iff type From can be implicitly converted to
// type To.
template <typename From, typename To>
class ImplicitlyConvertible {
const bool ImplicitlyConvertible<From, To>::value;
// IsAProtocolMessage<T>::value is a compile-time bool constant that's
-// true if T is type ProtocolMessage, proto2::Message, or a subclass
+// true iff T is type ProtocolMessage, proto2::Message, or a subclass
// of those.
template <typename T>
struct IsAProtocolMessage
# include <io.h>
#endif
-// Defines this to true if Google Test can use POSIX regular expressions.
+// Defines this to true iff Google Test can use POSIX regular expressions.
#ifndef GTEST_HAS_POSIX_RE
# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
#endif
# endif // _HAS_EXCEPTIONS
# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
# elif defined(__GNUC__) && __EXCEPTIONS
-// gcc defines __EXCEPTIONS to 1 if exceptions are enabled.
+// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
# define GTEST_HAS_EXCEPTIONS 1
# elif defined(__SUNPRO_CC)
// Sun Pro CC supports exceptions. However, there is no compile-time way of
// they are enabled unless the user tells us otherwise.
# define GTEST_HAS_EXCEPTIONS 1
# elif defined(__IBMCPP__) && __EXCEPTIONS
-// xlC defines __EXCEPTIONS to 1 if exceptions are enabled.
+// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
# define GTEST_HAS_EXCEPTIONS 1
# elif defined(__HP_aCC)
// Exception handling is in effect by default in HP aCC compiler. It has to
# ifdef _MSC_VER
-# ifdef _CPPRTTI // MSVC defines this macro if RTTI is enabled.
+# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
# define GTEST_HAS_RTTI 1
# else
# define GTEST_HAS_RTTI 0
# endif
-// Starting with version 4.3.2, gcc defines __GXX_RTTI if RTTI is enabled.
+// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
# ifdef __GXX_RTTI
// Returns the string representation of the regex.
const char* pattern() const { return pattern_; }
- // FullMatch(str, re) returns true if regular expression re matches
+ // FullMatch(str, re) returns true iff regular expression re matches
// the entire str.
- // PartialMatch(str, re) returns true if regular expression re
+ // PartialMatch(str, re) returns true iff regular expression re
// matches a substring of str (including str itself).
//
// TODO(wan@google.com): make FullMatch() and PartialMatch() work
// When non-NULL, used to block execution until the controller thread
// notifies.
Notification* const thread_can_start_;
- bool finished_; // true if we know that the thread function has finished.
+ bool finished_; // true iff we know that the thread function has finished.
pthread_t thread_; // The native thread object.
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
static const char* Utf16ToAnsi(LPCWSTR utf16_str);
#endif
- // Compares two C strings. Returns true if they have the same content.
+ // Compares two C strings. Returns true iff they have the same content.
//
// Unlike strcmp(), this function can handle NULL argument(s). A
// NULL C string is considered different to any non-NULL C string,
// the converted string in double quotes.
static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
- // Compares two wide C strings. Returns true if they have the same
+ // Compares two wide C strings. Returns true iff they have the same
// content.
//
// Unlike wcscmp(), this function can handle NULL argument(s). A
// including the empty string.
static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
- // Compares two C strings, ignoring case. Returns true if they
+ // Compares two C strings, ignoring case. Returns true iff they
// have the same content.
//
// Unlike strcasecmp(), this function can handle NULL argument(s).
static bool CaseInsensitiveCStringEquals(const char* lhs,
const char* rhs);
- // Compares two wide C strings, ignoring case. Returns true if they
+ // Compares two wide C strings, ignoring case. Returns true iff they
// have the same content.
//
// Unlike wcscasecmp(), this function can handle NULL argument(s).
operator ::string() const { return ::string(c_str(), length()); }
#endif // GTEST_HAS_GLOBAL_STRING
- // Returns true if this is an empty string (i.e. "").
+ // Returns true iff this is an empty string (i.e. "").
bool empty() const { return (c_str() != NULL) && (length() == 0); }
// Compares this with another String.
// if this is greater than rhs.
int Compare(const String& rhs) const;
- // Returns true if this String equals the given C string. A NULL
+ // Returns true iff this String equals the given C string. A NULL
// string and a non-NULL string are considered not equal.
bool operator==(const char* a_c_str) const { return Compare(a_c_str) == 0; }
- // Returns true if this String is less than the given String. A
+ // Returns true iff this String is less than the given String. A
// NULL string is considered less than "".
bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
- // Returns true if this String doesn't equal the given C string. A NULL
+ // Returns true iff this String doesn't equal the given C string. A NULL
// string and a non-NULL string are considered not equal.
bool operator!=(const char* a_c_str) const { return !(*this == a_c_str); }
- // Returns true if this String ends with the given suffix. *Any*
+ // Returns true iff this String ends with the given suffix. *Any*
// String is considered to end with a NULL or empty suffix.
bool EndsWith(const char* suffix) const;
- // Returns true if this String ends with the given suffix, not considering
+ // Returns true iff this String ends with the given suffix, not considering
// case. Any String is considered to end with a NULL or empty suffix.
bool EndsWithCaseInsensitive(const char* suffix) const;
template <int k> class Get;
// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// if k < the number of fields in tuple type T.
+// iff k < the number of fields in tuple type T.
template <bool kIndexValid, int kIndex, class Tuple>
struct TupleElement;
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-// AssertyTypeEq<T1, T2>::type is defined if T1 and T2 are the same
+// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
// type. This can be used as a compile-time assertion to ensure that
// two types are equal.