[llvm-commits] [llvm-gcc-4.2] r83312 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Bob Wilson bob.wilson at apple.com
Mon Oct 5 09:47:38 PDT 2009


Author: bwilson
Date: Mon Oct  5 11:47:38 2009
New Revision: 83312

URL: http://llvm.org/viewvc/llvm-project?rev=83312&view=rev
Log:
Change my previous optimization, for aggregates with only one element, to
only apply to types with constant sizes.  As Duncan explained on the mailing
list, there may be other elements at variable offsets that do not show up in
the llvm type.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=83312&r1=83311&r2=83312&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct  5 11:47:38 2009
@@ -1323,8 +1323,8 @@
   // If the type is small, copy the elements instead of using a block copy.
   const Type *LLVMTy = ConvertType(type);
   unsigned NumElts = CountAggregateElements(LLVMTy);
-  if (NumElts == 1 ||
-      (TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST &&
+  if (TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST &&
+      (NumElts == 1 ||  
        TREE_INT_CST_LOW(TYPE_SIZE_UNIT(type)) <
        TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY)) {
 





More information about the llvm-commits mailing list