summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-23 21:26:18 +0000
committerChris Lattner <sabre@nondot.org>2009-07-23 21:26:18 +0000
commit308c7896a486f2ab17b38882cda7b82f888cb7bd (patch)
tree07876301ca8dec4cadb388a1284c4328b32d6732 /llvm/lib
parent516e5e7835332802dc4cac8f3ab968a40feccbaf (diff)
downloadbcm5719-llvm-308c7896a486f2ab17b38882cda7b82f888cb7bd.tar.gz
bcm5719-llvm-308c7896a486f2ab17b38882cda7b82f888cb7bd.zip
"fix" PR4612, which is a crash on:
%0 = malloc [3758096384 x i32] The "malloc" instruction doesn't support 64-bits correctly (see PR715), and should be removed. Victor is actively working on fixing this, in the meantime just don't crash. llvm-svn: 76899
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 30236e36f3f..113537666da 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -5431,9 +5431,13 @@ void SelectionDAGLowering::visitMalloc(MallocInst &I) {
// multiply on 64-bit targets.
// FIXME: Malloc inst should go away: PR715.
uint64_t ElementSize = TD->getTypeAllocSize(I.getType()->getElementType());
- if (ElementSize != 1)
+ if (ElementSize != 1) {
+ // Src is always 32-bits, make sure the constant fits.
+ assert(Src.getValueType() == MVT::i32);
+ ElementSize = (uint32_t)ElementSize;
Src = DAG.getNode(ISD::MUL, getCurDebugLoc(), Src.getValueType(),
Src, DAG.getConstant(ElementSize, Src.getValueType()));
+ }
MVT IntPtr = TLI.getPointerTy();
OpenPOWER on IntegriCloud