summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/InterferenceCache.cpp4
-rw-r--r--llvm/lib/CodeGen/LiveIntervalUnion.cpp2
-rw-r--r--llvm/lib/CodeGen/RegisterPressure.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/InterferenceCache.cpp b/llvm/lib/CodeGen/InterferenceCache.cpp
index 72227cc7bba..82f6e8d8e23 100644
--- a/llvm/lib/CodeGen/InterferenceCache.cpp
+++ b/llvm/lib/CodeGen/InterferenceCache.cpp
@@ -48,8 +48,8 @@ void InterferenceCache::reinitPhysRegEntries() {
if (PhysRegEntriesCount == TRI->getNumRegs()) return;
free(PhysRegEntries);
PhysRegEntriesCount = TRI->getNumRegs();
- PhysRegEntries = (unsigned char*)
- calloc(PhysRegEntriesCount, sizeof(unsigned char));
+ PhysRegEntries = static_cast<unsigned char*>(
+ safe_calloc(PhysRegEntriesCount, sizeof(unsigned char)));
}
void InterferenceCache::init(MachineFunction *mf,
diff --git a/llvm/lib/CodeGen/LiveIntervalUnion.cpp b/llvm/lib/CodeGen/LiveIntervalUnion.cpp
index 3e742a6c2f2..36428e0335f 100644
--- a/llvm/lib/CodeGen/LiveIntervalUnion.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalUnion.cpp
@@ -187,7 +187,7 @@ void LiveIntervalUnion::Array::init(LiveIntervalUnion::Allocator &Alloc,
clear();
Size = NSize;
LIUs = static_cast<LiveIntervalUnion*>(
- malloc(sizeof(LiveIntervalUnion)*NSize));
+ safe_malloc(sizeof(LiveIntervalUnion)*NSize));
for (unsigned i = 0; i != Size; ++i)
new(LIUs + i) LiveIntervalUnion(Alloc);
}
diff --git a/llvm/lib/CodeGen/RegisterPressure.cpp b/llvm/lib/CodeGen/RegisterPressure.cpp
index bc1af1594c2..97e5851e025 100644
--- a/llvm/lib/CodeGen/RegisterPressure.cpp
+++ b/llvm/lib/CodeGen/RegisterPressure.cpp
@@ -635,7 +635,7 @@ void PressureDiffs::init(unsigned N) {
}
Max = Size;
free(PDiffArray);
- PDiffArray = reinterpret_cast<PressureDiff*>(calloc(N, sizeof(PressureDiff)));
+ PDiffArray = static_cast<PressureDiff*>(safe_calloc(N, sizeof(PressureDiff)));
}
void PressureDiffs::addInstruction(unsigned Idx,
OpenPOWER on IntegriCloud