[llvm-commits] [llvm] r76899 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Chris Lattner
sabre at nondot.org
Thu Jul 23 14:27:06 PDT 2009
Author: lattner
Date: Thu Jul 23 16:26:18 2009
New Revision: 76899
URL: http://llvm.org/viewvc/llvm-project?rev=76899&view=rev
Log:
"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.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=76899&r1=76898&r2=76899&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Thu Jul 23 16:26:18 2009
@@ -5431,9 +5431,13 @@
// 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();
More information about the llvm-commits
mailing list