summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-09-10 11:31:39 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-09-10 11:31:39 +0000
commit4bf4e8686cb27c0524773659b5ec20bdefb31931 (patch)
treef8e79419a201e65d3efa879d1b264ba253169b83 /llvm
parentf4858d59e5f80f4d2e0689677d6d1abb0356af2d (diff)
downloadbcm5719-llvm-4bf4e8686cb27c0524773659b5ec20bdefb31931.tar.gz
bcm5719-llvm-4bf4e8686cb27c0524773659b5ec20bdefb31931.zip
Add some braces to make newer GCCs happy and update CMakeLists.
llvm-svn: 81443
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Analysis/CMakeLists.txt1
-rw-r--r--llvm/lib/Analysis/MallocHelper.cpp2
-rw-r--r--llvm/lib/VMCore/Instructions.cpp8
3 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt
index 735e8a72ae7..d2333224f8f 100644
--- a/llvm/lib/Analysis/CMakeLists.txt
+++ b/llvm/lib/Analysis/CMakeLists.txt
@@ -22,6 +22,7 @@ add_llvm_library(LLVMAnalysis
LoopInfo.cpp
LoopPass.cpp
LoopVR.cpp
+ MallocHelper.cpp
MemoryDependenceAnalysis.cpp
PointerTracking.cpp
PostDominators.cpp
diff --git a/llvm/lib/Analysis/MallocHelper.cpp b/llvm/lib/Analysis/MallocHelper.cpp
index 5001110c6af..567268c6797 100644
--- a/llvm/lib/Analysis/MallocHelper.cpp
+++ b/llvm/lib/Analysis/MallocHelper.cpp
@@ -188,7 +188,7 @@ Value* llvm::getMallocArraySize(CallInst* CI) {
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))
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index a03587107cc..e52bc1c0518 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -462,7 +462,7 @@ static Value *checkArraySize(Value *Amt, const Type *IntPtrTy) {
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 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
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 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
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 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
AllocSize = BinaryOperator::CreateMul(Scale, AllocSize,
"", InsertAtEnd);
}
+ }
// Create the call to Malloc.
BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd;
OpenPOWER on IntegriCloud