"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
This commit is contained in:
Chris Lattner 2009-07-23 21:26:18 +00:00
parent 17e4aa7d0a
commit 50340f666b

View File

@ -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();