aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/iMemory.h4
-rw-r--r--lib/VMCore/iMemory.cpp6
2 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h
index 13b1400d3a..ec04b281db 100644
--- a/include/llvm/iMemory.h
+++ b/include/llvm/iMemory.h
@@ -35,9 +35,9 @@ public:
}
// isArrayAllocation - Return true if there is an allocation size parameter
- // to the allocation instruction.
+ // to the allocation instruction that is not 1.
//
- inline bool isArrayAllocation() const { return Operands.size() == 1; }
+ bool isArrayAllocation() const;
inline const Value *getArraySize() const {
assert(isArrayAllocation()); return Operands[0];
diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp
index 4226a69615..7280998a17 100644
--- a/lib/VMCore/iMemory.cpp
+++ b/lib/VMCore/iMemory.cpp
@@ -5,12 +5,18 @@
//===----------------------------------------------------------------------===//
#include "llvm/iMemory.h"
+#include "llvm/ConstantVals.h"
static inline const Type *checkType(const Type *Ty) {
assert(Ty && "Invalid indices for type!");
return Ty;
}
+bool AllocationInst::isArrayAllocation() const {
+ return getNumOperands() == 1 &&
+ getOperand(0) != ConstantUInt::get(Type::UIntTy, 1);
+}
+
//===----------------------------------------------------------------------===//
// MemAccessInst Implementation
//===----------------------------------------------------------------------===//