[llvm-commits] [llvm] r81443 - in /llvm/trunk/lib: Analysis/CMakeLists.txt Analysis/MallocHelper.cpp VMCore/Instructions.cpp
Benjamin Kramer
benny.kra at googlemail.com
Thu Sep 10 04:31:40 PDT 2009
Author: d0k
Date: Thu Sep 10 06:31:39 2009
New Revision: 81443
URL: http://llvm.org/viewvc/llvm-project?rev=81443&view=rev
Log:
Add some braces to make newer GCCs happy and update CMakeLists.
Modified:
llvm/trunk/lib/Analysis/CMakeLists.txt
llvm/trunk/lib/Analysis/MallocHelper.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/lib/Analysis/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CMakeLists.txt?rev=81443&r1=81442&r2=81443&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CMakeLists.txt (original)
+++ llvm/trunk/lib/Analysis/CMakeLists.txt Thu Sep 10 06:31:39 2009
@@ -22,6 +22,7 @@
LoopInfo.cpp
LoopPass.cpp
LoopVR.cpp
+ MallocHelper.cpp
MemoryDependenceAnalysis.cpp
PointerTracking.cpp
PostDominators.cpp
Modified: llvm/trunk/lib/Analysis/MallocHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MallocHelper.cpp?rev=81443&r1=81442&r2=81443&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MallocHelper.cpp (original)
+++ llvm/trunk/lib/Analysis/MallocHelper.cpp Thu Sep 10 06:31:39 2009
@@ -188,7 +188,7 @@
Constant* CO = dyn_cast<Constant>(MallocArg);
BinaryOperator* BO = dyn_cast<BinaryOperator>(MallocArg);
- assert(isConstantOne(ElementSize) || CO || BO &&
+ assert((isConstantOne(ElementSize) || CO || BO) &&
"getMallocArraySize and malformed malloc IR");
if (isConstantOne(ElementSize))
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=81443&r1=81442&r2=81443&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Sep 10 06:31:39 2009
@@ -462,7 +462,7 @@
static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
const Type *AllocTy, const Type *IntPtrTy,
Value *ArraySize, const Twine &NameStr) {
- assert((!InsertBefore && InsertAtEnd || InsertBefore && !InsertAtEnd) &&
+ assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
"createMalloc needs only InsertBefore or InsertAtEnd");
const PointerType *AllocPtrType = dyn_cast<PointerType>(AllocTy);
assert(AllocPtrType && "CreateMalloc passed a non-pointer allocation type");
@@ -473,7 +473,7 @@
Value *AllocSize = ConstantExpr::getSizeOf(AllocPtrType->getElementType());
AllocSize = ConstantExpr::getTruncOrBitCast(cast<Constant>(AllocSize),
IntPtrTy);
- if (!IsConstantOne(ArraySize))
+ if (!IsConstantOne(ArraySize)) {
if (IsConstantOne(AllocSize)) {
AllocSize = ArraySize; // Operand * 1 = Operand
} else if (Constant *CO = dyn_cast<Constant>(ArraySize)) {
@@ -483,13 +483,14 @@
AllocSize = ConstantExpr::getMul(Scale, cast<Constant>(AllocSize));
} else {
Value *Scale = ArraySize;
- if (Scale->getType() != IntPtrTy)
+ if (Scale->getType() != IntPtrTy) {
if (InsertBefore)
Scale = CastInst::CreateIntegerCast(Scale, IntPtrTy, false /*ZExt*/,
"", InsertBefore);
else
Scale = CastInst::CreateIntegerCast(Scale, IntPtrTy, false /*ZExt*/,
"", InsertAtEnd);
+ }
// Multiply type size by the array size...
if (InsertBefore)
AllocSize = BinaryOperator::CreateMul(Scale, AllocSize,
@@ -498,6 +499,7 @@
AllocSize = BinaryOperator::CreateMul(Scale, AllocSize,
"", InsertAtEnd);
}
+ }
// Create the call to Malloc.
BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd;
More information about the llvm-commits
mailing list