[llvm-commits] [dragonegg] r169389 - in /dragonegg/trunk: src/Convert.cpp test/validator/c/ConstructorAsLValue.c

Duncan Sands baldrick at free.fr
Wed Dec 5 08:04:46 PST 2012


Author: baldrick
Date: Wed Dec  5 10:04:46 2012
New Revision: 169389

URL: http://llvm.org/viewvc/llvm-project?rev=169389&view=rev
Log:
The GCC optimizers can generate code that requires getting the address of a
CONSTRUCTOR, not to write to it, just to cast it.  While there, chuck in
FIXED_CST here too since it is a simple constant like INTEGER_CST etc.

Added:
    dragonegg/trunk/test/validator/c/ConstructorAsLValue.c
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=169389&r1=169388&r2=169389&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Wed Dec  5 10:04:46 2012
@@ -1735,7 +1735,9 @@
     LV = LValue(AddressOfLABEL_DECL(exp), 1);
     break;
   }
+  case CONSTRUCTOR:
   case COMPLEX_CST:
+  case FIXED_CST:
   case INTEGER_CST:
   case REAL_CST:
   case STRING_CST:

Added: dragonegg/trunk/test/validator/c/ConstructorAsLValue.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/ConstructorAsLValue.c?rev=169389&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/ConstructorAsLValue.c (added)
+++ dragonegg/trunk/test/validator/c/ConstructorAsLValue.c Wed Dec  5 10:04:46 2012
@@ -0,0 +1,16 @@
+// RUN: %dragonegg -S %s -fplugin-arg-dragonegg-enable-gcc-optzns -O1
+#define __vector __attribute__((vector_size(16) ))
+typedef __vector signed char qword;
+typedef __vector unsigned int VU32;
+extern short g[192 +16];
+void f(qword);
+void f1 (unsigned ctr)
+{
+  VU32 pin;
+  pin = (VU32){(__SIZE_TYPE__)&g[16]};
+  do {
+   f((qword)pin);
+   ctr--;
+  }
+while(ctr);
+}





More information about the llvm-commits mailing list