[llvm-commits] [llvm] r54505 - in /llvm/trunk/test/FrontendC: 2008-08-07-AlignPadding1.c 2008-08-07-AlignPadding2.c

Dale Johannesen dalej at apple.com
Thu Aug 7 20:37:11 PDT 2008


Author: johannes
Date: Thu Aug  7 22:37:11 2008
New Revision: 54505

URL: http://llvm.org/viewvc/llvm-project?rev=54505&view=rev
Log:
Testcases for 54503.  One derived from PR 2533, the
other from Python.


Added:
    llvm/trunk/test/FrontendC/2008-08-07-AlignPadding1.c
    llvm/trunk/test/FrontendC/2008-08-07-AlignPadding2.c

Added: llvm/trunk/test/FrontendC/2008-08-07-AlignPadding1.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2008-08-07-AlignPadding1.c?rev=54505&view=auto

==============================================================================
--- llvm/trunk/test/FrontendC/2008-08-07-AlignPadding1.c (added)
+++ llvm/trunk/test/FrontendC/2008-08-07-AlignPadding1.c Thu Aug  7 22:37:11 2008
@@ -0,0 +1,29 @@
+/* RUN: %llvmgcc %s -m64 -S -o - -emit-llvm -O0 | grep zeroinitializer | count 6
+
+The FE must generate padding here both at the end of each PyG_Head and
+between array elements.  Reduced from Python. */
+
+typedef union _gc_head {
+  struct {
+    union _gc_head *gc_next;
+    union _gc_head *gc_prev;
+    long gc_refs;
+  } gc;
+  int dummy __attribute__((aligned(16)));
+} PyGC_Head;
+
+struct gc_generation {
+  PyGC_Head head;
+  int threshold;
+  int count;
+};
+
+#define GEN_HEAD(n) (&generations[n].head)
+
+/* linked lists of container objects */
+static struct gc_generation generations[3] = {
+        /* PyGC_Head,                           threshold,      count */
+        {{{GEN_HEAD(0), GEN_HEAD(0), 0}},       700,            0},
+        {{{GEN_HEAD(1), GEN_HEAD(1), 0}},       10,             0},
+        {{{GEN_HEAD(2), GEN_HEAD(2), 0}},       10,             0},
+};

Added: llvm/trunk/test/FrontendC/2008-08-07-AlignPadding2.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2008-08-07-AlignPadding2.c?rev=54505&view=auto

==============================================================================
--- llvm/trunk/test/FrontendC/2008-08-07-AlignPadding2.c (added)
+++ llvm/trunk/test/FrontendC/2008-08-07-AlignPadding2.c Thu Aug  7 22:37:11 2008
@@ -0,0 +1,18 @@
+/* RUN: %llvmgcc %s -m64 -S -o - -emit-llvm -O0 | grep zeroinitializer | count 1
+
+The FE must not generate padding here between array elements.  PR 2533. */
+
+typedef struct {
+ const char *name;
+ int flags;
+ union {
+   int x;
+ } u;
+} OptionDef;
+
+const OptionDef options[] = {
+ /* main options */
+ { "a", 0, {3} },
+ { "b", 0, {4} },
+ { 0, },
+};





More information about the llvm-commits mailing list