aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-07-27 22:35:40 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-07-27 22:35:40 +0000
commitb3c334674ddf4671c22d750a612e91e481a33ac8 (patch)
tree936c2f00e6b1ade0fcad41ce4c4c943e0e778f00
parent5fa5de80e21a49f9f2be8a22a9e12443321fc812 (diff)
Allocating too large an array for ReachibilityMatrix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29367 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86ISelDAGToDAG.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp
index 901409a154..b6d2a8e9da 100644
--- a/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -281,8 +281,11 @@ void X86DAGToDAGISel::DetermineTopologicalOrdering() {
void X86DAGToDAGISel::DeterminReachibility(SDNode *f, SDNode *t) {
if (!ReachibilityMatrix) {
DetermineTopologicalOrdering();
- ReachibilityMatrix = new unsigned char[DAGSize * DAGSize];
- memset(ReachibilityMatrix, 0, DAGSize * DAGSize * sizeof(unsigned char));
+ unsigned RMSize = DAGSize * DAGSize / 8;
+ if ((DAGSize * DAGSize) % 8)
+ RMSize++;
+ ReachibilityMatrix = new unsigned char[RMSize];
+ memset(ReachibilityMatrix, 0, RMSize);
}
int Idf = f->getNodeId();