https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117639

            Bug ID: 117639
           Summary: Modified loop-split-1.C doesn't recognise non-escaping
                    std::vector<float>
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Tweaked g++.dg/tree-ssa/loop-split-1.C:
```
#include <vector>
#include <cmath>

constexpr unsigned s = 100000000;

void p()
{
    std::vector<float> a, b, c;
    a.resize(s);
    b.resize(s);
    c.resize(s);

    for(unsigned i = 0; i < s; ++i)
    {
        if(i == 0)
            a[i] = b[i] * c[i];
        else
            a[i] = (b[i] + c[i]) * c[i-1] * std::log(i);
    }
}
```

Clang optimises this out to just ret.

Reply via email to