[llvm-commits] [dragonegg] r137824 - /dragonegg/trunk/src/Convert.cpp

Duncan Sands baldrick at free.fr
Wed Aug 17 03:53:31 PDT 2011


Author: baldrick
Date: Wed Aug 17 05:53:31 2011
New Revision: 137824

URL: http://llvm.org/viewvc/llvm-project?rev=137824&view=rev
Log:
Now that we test the field size to see if it is non-zero it is
also necessary to check that the field has a size (previously
this was not needed explicitly since it would be check later
by the recursion).  Also, allow an element-by-element memset/
memcpy that works on four elements or less (previously it was
three elements or less).

Modified:
    dragonegg/trunk/src/Convert.cpp

Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=137824&r1=137823&r2=137824&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Wed Aug 17 05:53:31 2011
@@ -1451,6 +1451,10 @@
     unsigned TotalCost = 0;
     for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) {
       assert(TREE_CODE(Field) == FIELD_DECL && "Lang data not freed?");
+      // If the field has no size, for example because it is a C-style variable
+      // length array, then just give up.
+      if (!DECL_SIZE(Field))
+        return TooCostly;
       // Ignore fields of size zero.  This way, we don't give up just because
       // there is a size zero field that is not represented in the LLVM type.
       if (integer_zerop(DECL_SIZE(Field)))
@@ -1565,7 +1569,7 @@
 }
 
 #ifndef TARGET_DRAGONEGG_MEMCPY_COST
-#define TARGET_DRAGONEGG_MEMCPY_COST 4
+#define TARGET_DRAGONEGG_MEMCPY_COST 5
 #endif
 
 /// EmitAggregateCopy - Copy the elements from SrcLoc to DestLoc, using the
@@ -1650,7 +1654,7 @@
 }
 
 #ifndef TARGET_DRAGONEGG_MEMSET_COST
-#define TARGET_DRAGONEGG_MEMSET_COST 4
+#define TARGET_DRAGONEGG_MEMSET_COST 5
 #endif
 
 /// EmitAggregateZero - Zero the elements of DestLoc.





More information about the llvm-commits mailing list