summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-19 04:21:43 +0000
committerChris Lattner <sabre@nondot.org>2004-03-19 04:21:43 +0000
commit6b835360f1cd11ade3eedff3dc5a22469b9a31f6 (patch)
treeb6b2bf9a498073de880059cf3c147a4d09172b22
parentab18020cbd52d3fee2b1b05eeb26c420ac09e9d6 (diff)
downloadllvm-6b835360f1cd11ade3eedff3dc5a22469b9a31f6.tar.gz
llvm-6b835360f1cd11ade3eedff3dc5a22469b9a31f6.tar.bz2
llvm-6b835360f1cd11ade3eedff3dc5a22469b9a31f6.tar.xz
Fix PR299: [Sparc] Code generator asserts on alloc of zero size type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12504 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/SparcV9/SparcV9InstrSelection.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index 5a0d863123..480af95aad 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -1156,12 +1156,18 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
unsigned numElements,
std::vector<MachineInstr*>& getMvec)
{
- assert(tsize > 0 && "Illegal (zero) type size for alloca");
assert(result && result->getParent() &&
"Result value is not part of a function?");
Function *F = result->getParent()->getParent();
MachineFunction &mcInfo = MachineFunction::get(F);
+ // If the alloca is of zero bytes (which is perfectly legal) we bump it up to
+ // one byte. This is unnecessary, but I really don't want to break any
+ // fragile logic in this code. FIXME.
+ if (tsize == 0)
+ tsize = 1;
+
+
// Put the variable in the dynamically sized area of the frame if either:
// (a) The offset is too large to use as an immediate in load/stores
// (check LDX because all load/stores have the same-size immed. field).