aboutsummaryrefslogtreecommitdiffstats
path: root/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
commitb8523fae98888e969edc2fd5452887c686a0477c (patch)
tree668500f9efafed97debce9b1d7a161727bf4ac60 /lib
parentf147a5b2310d62860021367b5cd1b74fe6439ef8 (diff)
downloadexternal_llvm-b8523fae98888e969edc2fd5452887c686a0477c.zip
external_llvm-b8523fae98888e969edc2fd5452887c686a0477c.tar.gz
external_llvm-b8523fae98888e969edc2fd5452887c686a0477c.tar.bz2
"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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 30236e3..1135376 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/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();