[llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 18 22:22:01 PST 2004


Changes in directory llvm/lib/Target/SparcV9:

SparcV9InstrSelection.cpp updated: 1.137 -> 1.138

---
Log message:

Fix PR299: http://llvm.cs.uiuc.edu/PR299 : [Sparc] Code generator asserts on alloc of zero size type



---
Diffs of the changes:  (+7 -1)

Index: llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp:1.137 llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp:1.138
--- llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp:1.137	Fri Mar 12 18:23:46 2004
+++ llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp	Thu Mar 18 22:21:43 2004
@@ -1156,11 +1156,17 @@
                              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





More information about the llvm-commits mailing list