[llvm-commits] [dragonegg] r132801 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Constants.cpp src/Convert.cpp
Duncan Sands
baldrick at free.fr
Thu Jun 9 13:15:01 PDT 2011
Author: baldrick
Date: Thu Jun 9 15:15:01 2011
New Revision: 132801
URL: http://llvm.org/viewvc/llvm-project?rev=132801&view=rev
Log:
Avoid unused variable compiler warnings when assertions are
disabled.
Modified:
dragonegg/trunk/include/dragonegg/Internals.h
dragonegg/trunk/src/Constants.cpp
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=132801&r1=132800&r2=132801&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Thu Jun 9 15:15:01 2011
@@ -114,6 +114,7 @@
/// give up the ghost, quit miserably.
inline void LLVM_ATTRIBUTE_NORETURN DieAbjectly(const char *Message) {
llvm_unreachable(Message);
+ (void)Message; // Avoid unused variable warning when assertions are disabled.
}
inline void LLVM_ATTRIBUTE_NORETURN DieAbjectly(const char *Message,
union gimple_statement_d *stmt){
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=132801&r1=132800&r2=132801&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Thu Jun 9 15:15:01 2011
@@ -321,13 +321,12 @@
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
const Type *EltTy = ATy->getElementType();
- const unsigned NumElts = ATy->getNumElements();
const unsigned Stride = getTargetData().getTypeAllocSizeInBits(EltTy);
assert(Stride > 0 && "Store size smaller than alloc size?");
// Elements with indices in [FirstElt, LastElt) overlap the range.
unsigned FirstElt = R.getFirst() / Stride;
unsigned LastElt = (R.getLast() + Stride - 1) / Stride;
- assert(LastElt <= NumElts && "Store size bigger than array?");
+ assert(LastElt <= ATy->getNumElements() && "Store size bigger than array?");
// Visit all elements that overlap the requested range, accumulating their
// bits in Bits.
BitSlice Bits;
@@ -369,13 +368,12 @@
case Type::VectorTyID: {
const VectorType *VTy = cast<VectorType>(Ty);
const Type *EltTy = VTy->getElementType();
- const unsigned NumElts = VTy->getNumElements();
const unsigned Stride = getTargetData().getTypeAllocSizeInBits(EltTy);
assert(Stride > 0 && "Store size smaller than alloc size?");
// Elements with indices in [FirstElt, LastElt) overlap the range.
unsigned FirstElt = R.getFirst() / Stride;
unsigned LastElt = (R.getLast() + Stride - 1) / Stride;
- assert(LastElt <= NumElts && "Store size bigger than vector?");
+ assert(LastElt <= VTy->getNumElements() && "Store size bigger than vector?");
// Visit all elements that overlap the requested range, accumulating their
// bits in Bits.
BitSlice Bits;
@@ -711,6 +709,7 @@
std::vector<unsigned char> Buffer(SizeInChars);
unsigned CharsWritten = native_encode_expr(exp, &Buffer[0], SizeInChars);
assert(CharsWritten == SizeInChars && "Failed to fully encode expression!");
+ (void)CharsWritten; // Avoid unused variable warning when assertions disabled.
// Turn it into an LLVM byte array.
return ConstantArray::get(Context, StringRef((char *)&Buffer[0], SizeInChars),
/*AddNull*/false);
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=132801&r1=132800&r2=132801&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Thu Jun 9 15:15:01 2011
@@ -7146,13 +7146,13 @@
tree type = TREE_TYPE(op0);
if (TREE_CODE(type) == COMPLEX_TYPE) {
- tree elt_type = TREE_TYPE(type);
Value *LHSr, *LHSi; SplitComplex(LHS, LHSr, LHSi);
Value *RHSr, *RHSi; SplitComplex(RHS, RHSr, RHSi);
Value *DSTr, *DSTi;
// (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))
- assert (SCALAR_FLOAT_TYPE_P(elt_type) && "RDIV_EXPR not floating point!");
+ assert (SCALAR_FLOAT_TYPE_P(TREE_TYPE(type)) &&
+ "RDIV_EXPR not floating point!");
Value *Tmp1 = Builder.CreateFMul(LHSr, RHSr); // a*c
Value *Tmp2 = Builder.CreateFMul(LHSi, RHSi); // b*d
Value *Tmp3 = Builder.CreateFAdd(Tmp1, Tmp2); // ac+bd
More information about the llvm-commits
mailing list