}
unsigned ConstantExpr::getPredicate() const {
- assert(getOpcode() == Instruction::FCmp ||
- getOpcode() == Instruction::ICmp);
+ assert(isCompare());
return ((const CompareConstantExpr*)this)->predicate;
}
/// convertToString - Helper function for getAsString() and getAsCString().
-static std::string convertToString(const User *U, unsigned len)
-{
+static std::string convertToString(const User *U, unsigned len) {
std::string Result;
Result.reserve(len);
for (unsigned i = 0; i != len; ++i)
/// This function will return true iff every element in this vector constant
/// is set to all ones.
-/// @returns true iff this constant's emements are all set to all ones.
+/// @returns true iff this constant's elements are all set to all ones.
/// @brief Determine if the value is all ones.
bool ConstantVector::isAllOnesValue() const {
// Check out first element.
const ConstantInt *CI = dyn_cast<ConstantInt>(Elt);
if (!CI || !CI->isAllOnesValue()) return false;
// Then make sure all remaining elements point to the same value.
- for (unsigned I = 1, E = getNumOperands(); I < E; ++I) {
- if (getOperand(I) != Elt) return false;
- }
+ for (unsigned I = 1, E = getNumOperands(); I < E; ++I)
+ if (getOperand(I) != Elt)
+ return false;
+
return true;
}
Constant *Elt = getOperand(0);
// Then make sure all remaining elements point to the same value.
for (unsigned I = 1, E = getNumOperands(); I < E; ++I)
- if (getOperand(I) != Elt) return 0;
+ if (getOperand(I) != Elt)
+ return 0;
return Elt;
}