[llvm-commits] [llvm] r135360 - /llvm/trunk/lib/VMCore/Constants.cpp
Chris Lattner
sabre at nondot.org
Sat Jul 16 23:01:31 PDT 2011
Author: lattner
Date: Sun Jul 17 01:01:30 2011
New Revision: 135360
URL: http://llvm.org/viewvc/llvm-project?rev=135360&view=rev
Log:
tidy up
Modified:
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=135360&r1=135359&r2=135360&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Sun Jul 17 01:01:30 2011
@@ -785,8 +785,7 @@
}
unsigned ConstantExpr::getPredicate() const {
- assert(getOpcode() == Instruction::FCmp ||
- getOpcode() == Instruction::ICmp);
+ assert(isCompare());
return ((const CompareConstantExpr*)this)->predicate;
}
@@ -1028,8 +1027,7 @@
/// 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)
@@ -1075,7 +1073,7 @@
/// 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.
@@ -1083,9 +1081,10 @@
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;
}
@@ -1096,7 +1095,8 @@
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;
}
More information about the llvm-commits
mailing list