summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-14 19:22:48 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-14 19:22:48 +0000
commit343eddd00259937d7584eb5fc93b9590f4653cd3 (patch)
tree335e553c6dea9bc188ab372210221a9f1d763eaa /gcc/testsuite/gcc.dg
parent2d8098311f7ecca4621d83af2b7aba09431e6e6b (diff)
downloadgcc-343eddd00259937d7584eb5fc93b9590f4653cd3.tar.gz
PR tree-optimization/52558
Backport from mainline: 2012-05-21 Aldy Hernandez <aldyh@redhat.com> * gimple.h (gimple_set_in_transaction): Remove. (gimple_in_transaction): Look in BB instead. (gimple_statement_base): Remove in_transaction field. * basic-block.h (enum bb_flags): Add BB_IN_TRANSACTION. * trans-mem.c (compute_transaction_bits): Place transaction bit information into basic blocks. 2012-05-31 Aldy Hernandez <aldyh@redhat.com> PR tree-optimization/52558 * cfg.c (alloc_aux_for_edge): Fix comment. (alloc_aux_for_edge): Remove static. * basic-block.h (alloc_aux_for_edge): Protoize. * tree-ssa-loop-im.c (execute_sm_if_changed): New. (execute_sm_if_changed_flag): New. (execute_sm_if_changed_flag_set): New. (execute_sm): Do not generate data races unless requested. (tree_ssa_lim_initialize): Call alloc_aux_for_edges. (tree_ssa_lim_finalize): Call free_aux_for_edges. * gimple.h (block_in_transaction): New. (gimple_in_transaction): Use block_in_transaction. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@188631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/pr52558-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr52558-2.c23
-rw-r--r--gcc/testsuite/gcc.dg/tm/reg-promotion.c24
3 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr52558-1.c b/gcc/testsuite/gcc.dg/pr52558-1.c
new file mode 100644
index 00000000000..c34ad0655d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52558-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "--param allow-store-data-races=0 -O2 -fdump-tree-lim1" } */
+
+/* Test that `count' is not written to unless p->data > 0. */
+
+int count;
+
+struct obj {
+ int data;
+ struct obj *next;
+} *q;
+
+void func()
+{
+ struct obj *p;
+ for (p = q; p; p = p->next)
+ if (p->data > 0)
+ count++;
+}
+
+/* { dg-final { scan-tree-dump-times "MEM count_lsm.. count_lsm_flag" 1 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc/testsuite/gcc.dg/pr52558-2.c b/gcc/testsuite/gcc.dg/pr52558-2.c
new file mode 100644
index 00000000000..6d5f51c4f0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52558-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "--param allow-store-data-races=0 -O2 -fdump-tree-lim1" } */
+
+/* Test that g_2 is not written to unless !g_1. */
+
+int g_1 = 1;
+int g_2 = 0;
+
+int func_1(void)
+{
+ int l;
+ for (l = 0; l < 1234; l++)
+ {
+ if (g_1)
+ return l;
+ else
+ g_2 = 0;
+ }
+ return 999;
+}
+
+/* { dg-final { scan-tree-dump-times "MEM.*g_2_lsm_flag" 1 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc/testsuite/gcc.dg/tm/reg-promotion.c b/gcc/testsuite/gcc.dg/tm/reg-promotion.c
new file mode 100644
index 00000000000..337c29f6c6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/reg-promotion.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O2 -fdump-tree-lim1" } */
+
+/* Test that `count' is not written to unless p->data>0. */
+
+int count;
+
+struct obj {
+ int data;
+ struct obj *next;
+} *q;
+
+void func()
+{
+ struct obj *p;
+ __transaction_atomic {
+ for (p = q; p; p = p->next)
+ if (p->data > 0)
+ count++;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "MEM count_lsm.. count_lsm_flag" 1 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */