OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [tree-ssa/] [pr19786.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
// { dg-do run }
// { dg-do run }
/* { dg-options "-O2" } */
/* { dg-options "-O2" } */
// We used to get alias grouping wrong on this one, hoisting accesses
// We used to get alias grouping wrong on this one, hoisting accesses
// to the vector's end out of the loop.
// to the vector's end out of the loop.
#include 
#include 
#include 
#include 
struct A
struct A
{
{
  double unused;      // If I remove it => it works.
  double unused;      // If I remove it => it works.
  std::vector v;
  std::vector v;
  A() : v(1) {}
  A() : v(1) {}
};
};
inline // If not inline => it works.
inline // If not inline => it works.
A g()
A g()
{
{
  A r;
  A r;
  r.v.resize(2);
  r.v.resize(2);
  r.v[0] = 1;
  r.v[0] = 1;
  while (!r.v.empty() && r.v.back() == 0)
  while (!r.v.empty() && r.v.back() == 0)
    r.v.pop_back();
    r.v.pop_back();
  return r;
  return r;
}
}
A f(const A &a)
A f(const A &a)
{
{
  if (a.v.empty())  return a;
  if (a.v.empty())  return 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.
  // A z = g(); return z;  // If I return like this => it works.
  return g();
  return g();
}
}
int main()
int main()
{
{
  A a;
  A a;
  A b;
  A b;
  A r = f(a);
  A r = f(a);
  assert(r.v.size() != 0);
  assert(r.v.size() != 0);
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.