tree-ssa-sccvn.h (vn_reference_op_struct): Add clique and base members.
authorRichard Biener <rguenther@suse.de>
Thu, 24 Sep 2015 07:35:55 +0000 (07:35 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 24 Sep 2015 07:35:55 +0000 (07:35 +0000)
2015-09-24  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.h (vn_reference_op_struct): Add clique and base
members.
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record clique
and base for MEM_REF and TARGET_MEM_REF.  Handle BIT_FIELD_REF
offset.
(ao_ref_init_from_vn_reference): Record clique and base in the
built base.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise

* g++.dg/tree-ssa/restrict3.C: New testcase.

From-SVN: r228074

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/restrict3.C [new file with mode: 0644]
gcc/tree-ssa-pre.c
gcc/tree-ssa-sccvn.c
gcc/tree-ssa-sccvn.h

index 5ae3e4436af36714dd403cfd6d51865b7d2aca16..8481677df625f31a7a64093b03213a1aa2c5439a 100644 (file)
@@ -1,3 +1,14 @@
+2015-09-24  Richard Biener  <rguenther@suse.de>
+
+       * tree-ssa-sccvn.h (vn_reference_op_struct): Add clique and base
+       members.
+       * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record clique
+       and base for MEM_REF and TARGET_MEM_REF.  Handle BIT_FIELD_REF
+       offset.
+       (ao_ref_init_from_vn_reference): Record clique and base in the
+       built base.
+       * tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise
+
 2015-09-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/48885
index 1d9b87273e9c1fdd6f50b8484c303f5dfb12453b..c9ffa70d5adc6525e9e018977ac80384f3d214b3 100644 (file)
@@ -1,3 +1,7 @@
+2015-09-24  Richard Biener  <rguenther@suse.de>
+
+       * g++.dg/tree-ssa/restrict3.C: New testcase.
+
 2015-09-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/48885
diff --git a/gcc/testsuite/g++.dg/tree-ssa/restrict3.C b/gcc/testsuite/g++.dg/tree-ssa/restrict3.C
new file mode 100644 (file)
index 0000000..d1e1343
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O -fdump-tree-fre1" }
+
+int
+f (int *__restrict__ &__restrict__ p, int *p2)
+{
+  *p = 1;
+  *p2 = 2;
+  return *p;
+}
+
+// { dg-final { scan-tree-dump "return 1;" "fre1" } }
index 56bc7bf1492ff3a4a77b0df3fb52b1a23a262834..ac298d3cabd052d00944eba7ea077ce6eab99c63 100644 (file)
@@ -2531,7 +2531,10 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
                                                     off));
            baseop = build_fold_addr_expr (base);
          }
-       return fold_build2 (MEM_REF, currop->type, baseop, offset);
+       genop = build2 (MEM_REF, currop->type, baseop, offset);
+       MR_DEPENDENCE_CLIQUE (genop) = currop->clique;
+       MR_DEPENDENCE_BASE (genop) = currop->base;
+       return genop;
       }
 
     case TARGET_MEM_REF:
@@ -2554,8 +2557,12 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
            if (!genop1)
              return NULL_TREE;
          }
-       return build5 (TARGET_MEM_REF, currop->type,
-                      baseop, currop->op2, genop0, currop->op1, genop1);
+       genop = build5 (TARGET_MEM_REF, currop->type,
+                       baseop, currop->op2, genop0, currop->op1, genop1);
+
+       MR_DEPENDENCE_CLIQUE (genop) = currop->clique;
+       MR_DEPENDENCE_BASE (genop) = currop->base;
+       return genop;
       }
 
     case ADDR_EXPR:
index 18529aca432aec490812e446204ac36533954d7b..57c1b55a4a68ca1714c23f2f1b38eee925113dac 100644 (file)
@@ -773,6 +773,8 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result)
       temp.op1 = TMR_STEP (ref);
       temp.op2 = TMR_OFFSET (ref);
       temp.off = -1;
+      temp.clique = MR_DEPENDENCE_CLIQUE (ref);
+      temp.base = MR_DEPENDENCE_BASE (ref);
       result->quick_push (temp);
 
       memset (&temp, 0, sizeof (temp));
@@ -816,11 +818,19 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result)
          temp.op0 = TREE_OPERAND (ref, 1);
          if (tree_fits_shwi_p (TREE_OPERAND (ref, 1)))
            temp.off = tree_to_shwi (TREE_OPERAND (ref, 1));
+         temp.clique = MR_DEPENDENCE_CLIQUE (ref);
+         temp.base = MR_DEPENDENCE_BASE (ref);
          break;
        case BIT_FIELD_REF:
          /* Record bits and position.  */
          temp.op0 = TREE_OPERAND (ref, 1);
          temp.op1 = TREE_OPERAND (ref, 2);
+         if (tree_fits_shwi_p (TREE_OPERAND (ref, 2)))
+           {
+             HOST_WIDE_INT off = tree_to_shwi (TREE_OPERAND (ref, 2));
+             if (off % BITS_PER_UNIT == 0)
+               temp.off = off / BITS_PER_UNIT;
+           }
          break;
        case COMPONENT_REF:
          /* The field decl is enough to unambiguously specify the field,
@@ -1017,6 +1027,8 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
          base_alias_set = get_deref_alias_set (op->op0);
          *op0_p = build2 (MEM_REF, op->type,
                           NULL_TREE, op->op0);
+         MR_DEPENDENCE_CLIQUE (*op0_p) = op->clique;
+         MR_DEPENDENCE_BASE (*op0_p) = op->base;
          op0_p = &TREE_OPERAND (*op0_p, 0);
          break;
 
index e3dddee0df1a1b5ae6ace8453a23f248edbd77d9..92ca85ab8be8a325364e03543dfc2f9828de39ba 100644 (file)
@@ -83,6 +83,9 @@ typedef struct vn_reference_op_struct
   ENUM_BITFIELD(tree_code) opcode : 16;
   /* 1 for instrumented calls.  */
   unsigned with_bounds : 1;
+  /* Dependence info, used for [TARGET_]MEM_REF only.  */
+  unsigned short clique;
+  unsigned short base;
   /* Constant offset this op adds or -1 if it is variable.  */
   HOST_WIDE_INT off;
   tree type;