tree-ssa-sccvn.h (vn_reference_op_struct): Add clique and base members.

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
This commit is contained in:
Richard Biener 2015-09-24 07:35:55 +00:00 committed by Richard Biener
parent 0a28fdcaf7
commit 1fefbb66c8
6 changed files with 52 additions and 3 deletions

View 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

View 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

View File

@ -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" } }

View 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:

View 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;

View 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;