mirror of git://gcc.gnu.org/git/gcc.git
re PR tree-optimization/19786 (Aliasing optimisation bug)
gcc/ChangeLog: PR tree-optimization/19786 * tree-ssa-alias.c (compute_flow_insensitive_aliasing): Add one tag to another's may-alias bitmap when adding to the other's list. gcc/testsuite/ChangeLog: PR tree-optimization/19786 * g++.dg/tree-ssa/pr19786.C: New. From-SVN: r95377
This commit is contained in:
parent
1d27fed446
commit
bb2e164049
|
@ -1,3 +1,9 @@
|
||||||
|
2005-02-21 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/19786
|
||||||
|
* tree-ssa-alias.c (compute_flow_insensitive_aliasing): Add one
|
||||||
|
tag to another's may-alias bitmap when adding to the other's list.
|
||||||
|
|
||||||
2005-02-21 DJ Delorie <dj@redhat.com>
|
2005-02-21 DJ Delorie <dj@redhat.com>
|
||||||
|
|
||||||
* tree-ssa-loop-ivopts.c (computation_cost): Start register
|
* tree-ssa-loop-ivopts.c (computation_cost): Start register
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2005-02-21 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/19786
|
||||||
|
* g++.dg/tree-ssa/pr19786.C: New.
|
||||||
|
|
||||||
2005-02-21 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
|
2005-02-21 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
|
||||||
|
|
||||||
* lib/gfortran-dg.exp (gfortran-dg-test): Split long regexps.
|
* lib/gfortran-dg.exp (gfortran-dg-test): Split long regexps.
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
// { dg-do run }
|
||||||
|
/* { dg-options "-O2" } */
|
||||||
|
|
||||||
|
// We used to get alias grouping wrong on this one, hoisting accesses
|
||||||
|
// to the vector's end out of the loop.
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
double unused; // If I remove it => it works.
|
||||||
|
std::vector<int> v;
|
||||||
|
|
||||||
|
A() : v(1) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline // If not inline => it works.
|
||||||
|
A g()
|
||||||
|
{
|
||||||
|
A r;
|
||||||
|
r.v.resize(2);
|
||||||
|
r.v[0] = 1;
|
||||||
|
|
||||||
|
while (!r.v.empty() && r.v.back() == 0)
|
||||||
|
r.v.pop_back();
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
A f(const A &a)
|
||||||
|
{
|
||||||
|
if (a.v.empty()) return a;
|
||||||
|
if (a.v.empty()) return a;
|
||||||
|
|
||||||
|
// A z = g(); return z; // If I return like this => it works.
|
||||||
|
return g();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
A a;
|
||||||
|
A b;
|
||||||
|
A r = f(a);
|
||||||
|
assert(r.v.size() != 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1116,6 +1116,7 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
|
||||||
/* Since TAG2 does not have any aliases of its own, add
|
/* Since TAG2 does not have any aliases of its own, add
|
||||||
TAG2 itself to the alias set of TAG1. */
|
TAG2 itself to the alias set of TAG1. */
|
||||||
add_may_alias (tag1, tag2);
|
add_may_alias (tag1, tag2);
|
||||||
|
SET_BIT (may_aliases1, var_ann (tag2)->uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue