re PR target/33604 (Revision 119502 causes significantly slower results with 4.3/4.4 compared to 4.2)
2007-11-09 Richard Guenther <rguenther@suse.de> PR tree-optimization/33604 * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Disregard changes in CV qualifiers of pointed to types for forward propagating ADDR_EXPRs. * tree-ssa-ccp.c (fold_stmt_r): Preserve volatileness of the original expression. * g++.dg/tree-ssa/pr33604.C: New testcase. * gcc.dg/pr32721.c: Adjust pattern. From-SVN: r130040
This commit is contained in:
parent
06acf7d0ad
commit
6aaa40131a
|
@ -1,3 +1,12 @@
|
|||
2007-11-09 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/33604
|
||||
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars):
|
||||
Disregard changes in CV qualifiers of pointed to types for
|
||||
forward propagating ADDR_EXPRs.
|
||||
* tree-ssa-ccp.c (fold_stmt_r): Preserve volatileness of the original
|
||||
expression.
|
||||
|
||||
2007-11-09 Richard Sandiford <rsandifo@nildram.co.uk>
|
||||
|
||||
* dse.c (find_shift_sequence): Always choose an integer mode for
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2007-11-09 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/33604
|
||||
* g++.dg/tree-ssa/pr33604.C: New testcase.
|
||||
* gcc.dg/pr32721.c: Adjust pattern.
|
||||
|
||||
2007-11-09 Richard Sandiford <rsandifo@nildram.co.uk>
|
||||
|
||||
* gcc.target/mips/dse-1.c: Disable.
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* { dg-do run } */
|
||||
/* { dg-options "-O -fdump-tree-forwprop1" } */
|
||||
|
||||
struct Value
|
||||
{
|
||||
double value;
|
||||
Value(double value_) : value (value_) {}
|
||||
operator double() const { return value; }
|
||||
Value& operator=(double other) { value = other; }
|
||||
};
|
||||
|
||||
struct Ref
|
||||
{
|
||||
const Value& m;
|
||||
Ref(const Value& m_) : m(m_) {}
|
||||
operator double() const { return m; }
|
||||
};
|
||||
|
||||
struct Diff
|
||||
{
|
||||
const Ref lhs, rhs;
|
||||
Diff(const Value& lhs_, const Value& rhs_) : lhs(lhs_), rhs(rhs_) {}
|
||||
operator double() const { return lhs - rhs; }
|
||||
};
|
||||
|
||||
extern "C" void abort (void);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Value I(1), m(4);
|
||||
for(int a = 0; a < 1000; a++)
|
||||
m = Diff (I, m);
|
||||
|
||||
if (!(m / 4 == I))
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check that we forward propagated
|
||||
D.2182_13 = (struct Ref *) &D.2137.lhs;
|
||||
to
|
||||
D.2182_13->lhs.m ={v} &I;
|
||||
yielding
|
||||
D.2137.lhs.m ={v} &I; */
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "D\\\.....\\\..hs\\\.m =" 2 "forwprop1" } } */
|
||||
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
|
|
@ -14,5 +14,6 @@ spinlock1 = &spinlock[1];
|
|||
while (*spinlock0);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "={v} \\*spinlock0" "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump "={v} .*spinlock" "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump "spinlock.* ={v}" "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||
|
|
|
@ -2034,6 +2034,7 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
|
|||
bool *inside_addr_expr_p = fold_stmt_r_data->inside_addr_expr_p;
|
||||
bool *changed_p = fold_stmt_r_data->changed_p;
|
||||
tree expr = *expr_p, t;
|
||||
bool volatile_p = TREE_THIS_VOLATILE (expr);
|
||||
|
||||
/* ??? It'd be nice if walk_tree had a pre-order option. */
|
||||
switch (TREE_CODE (expr))
|
||||
|
@ -2159,6 +2160,8 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
|
|||
|
||||
if (t)
|
||||
{
|
||||
/* Preserve volatileness of the original expression. */
|
||||
TREE_THIS_VOLATILE (t) = volatile_p;
|
||||
*expr_p = t;
|
||||
*changed_p = true;
|
||||
}
|
||||
|
|
|
@ -952,7 +952,15 @@ tree_ssa_forward_propagate_single_use_vars (void)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (TREE_CODE (rhs) == ADDR_EXPR)
|
||||
if (TREE_CODE (rhs) == ADDR_EXPR
|
||||
/* We can also disregard changes in CV qualifiers for
|
||||
the dereferenced value. */
|
||||
|| ((TREE_CODE (rhs) == NOP_EXPR
|
||||
|| TREE_CODE (rhs) == CONVERT_EXPR)
|
||||
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
|
||||
&& POINTER_TYPE_P (TREE_TYPE (rhs))
|
||||
&& useless_type_conversion_p (TREE_TYPE (TREE_TYPE (rhs)),
|
||||
TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0))))))
|
||||
{
|
||||
if (forward_propagate_addr_expr (lhs, rhs))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue