Commit 3facc4b6 by Andrew Pinski Committed by Andrew Pinski

re PR tree-optimization/14736 ([tree-ssa] code quality regression)


2004-06-02  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-optimization/14736
        * g++.dg/tree-ssa/ssa-cast-1.C: New Test.

        PR tree-optimization/14042
        * g++.dg/tree-ssa/ssa-sra-1.C: New Test.

        PR tree-optimization/14729
        * g++.dg/tree-ssa/ssa-sra-2.C: New Test.

2004-06-02  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-optimization/14042
        PR tree-optimization/14729
        PR tree-optimization/14736
        * tree-ssa.c: Check the type which the pointer points to
        instead of the pointer types.

From-SVN: r82573
parent 91fa0e3d
2004-06-02 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-optimization/14042
PR tree-optimization/14729
PR tree-optimization/14736
* tree-ssa.c: Check the type which the pointer points to
instead of the pointer types.
2004-06-02 Kazu Hirata <kazu@cs.umass.edu> 2004-06-02 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/15738. PR tree-optimization/15738.
......
2004-06-02 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-optimization/14736
* g++.dg/tree-ssa/ssa-cast-1.C: New Test.
PR tree-optimization/14042
* g++.dg/tree-ssa/ssa-sra-1.C: New Test.
PR tree-optimization/14729
* g++.dg/tree-ssa/ssa-sra-2.C: New Test.
2004-06-02 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> 2004-06-02 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15557 PR fortran/15557
......
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-vars" } */
int &f(int *a)
{
return *a;
}
/* There should be no cast as pointer and references are
considered the same type. */
/* { dg-final { scan-tree-dump-times "\\(int &\\)" 0 "vars"} } */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-vars-details" } */
void link_error();
struct State {
int p0, p1, p2;
inline State(){p0=0;p1=0;p2=0;}
inline State(const State &s) {
p0 = s.p0;
p1 = s.p1;
p2 = s.p2;
}
inline void operator =(const State &s) {
p0 = s.p0;
p1 = s.p1;
p2 = s.p2;
}
inline void step(void) {
p0 = p1+p2;
p1 = p0*p1+p2;
p2 = p0-p2;
}
};
inline void iterate_ok(State &inS1, State &inS2, unsigned int n)
{
State s1 = inS1;
for (unsigned int i = 0; i < n; i++) {
s1.step();
}
inS1 = s1;
}
void temp()
{
State s1;
s1.p0 = 0;
s1.p1 = 0;
s1.p2 = 0;
State s2;
s2.p0 = 0;
s2.p1 = 0;
s2.p2 = 0;
iterate_ok (s1, s2, 1);
if (s1.p0)
link_error();
if (s1.p0)
link_error();
if (s1.p0)
link_error();
}
/* We should removed the casts from pointers to references and caused SRA to happen. */
/* { dg-final { scan-tree-dump-times "link_error" 0 "vars"} } */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-vars-details" } */
void link_error();
struct OOf {
int value;
OOf() {value = 0;}
};
inline OOf operator+(OOf op1, OOf op2)
{
OOf f;
f.value = op1.value + op2.value;
return f;
}
inline OOf operator*(OOf op1, OOf op2)
{
OOf f;
f.value = op1.value * op2.value;
return f;
}
inline OOf operator-(OOf op1, OOf op2)
{
OOf f;
f.value = op1.value - op2.value;
return f;
}
inline OOf test_func(
OOf a,
OOf b,
OOf c
)
{
OOf d, e;
OOf result;
d = a * b + b * c;
e = a * c - b * d;
result = d * e;
return result;
}
void test()
{
OOf a, b, c;
OOf d = test_func (a,b,c);
if (d.value)
link_error();
}
/* We should removed the casts from pointers to references and caused SRA to happen. */
/* { dg-final { scan-tree-dump-times "link_error" 0 "vars"} } */
...@@ -555,7 +555,8 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type) ...@@ -555,7 +555,8 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
so strip conversions that just switch between them. */ so strip conversions that just switch between them. */
else if (POINTER_TYPE_P (inner_type) else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type) && POINTER_TYPE_P (outer_type)
&& lang_hooks.types_compatible_p (inner_type, outer_type)) && lang_hooks.types_compatible_p (TREE_TYPE (inner_type),
TREE_TYPE (outer_type)))
return true; return true;
/* If both the inner and outer types are integral types, then the /* If both the inner and outer types are integral types, then the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment