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

            Bug ID: 114822
           Summary: ldist should produce memcpy/memset/memmove histograms
                    based on loop information converted
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

When loop is converted to string builtin we lose information about its size.
This means that we won't expand it inline when the block size is expected to be
small.  This causes performance problem i.e. on std::vector and testcase from
PR114821  which at least with profile feedback runs significantly slower than
variant where memcpy is produced early


#include <vector>
typedef unsigned int uint32_t;
int pair;
void
test()
{
        std::vector<int> stack;
        stack.push_back (pair);
        while (!stack.empty()) {
                int cur = stack.back();
                stack.pop_back();
                if (true)
                {
                        cur++;
                        stack.push_back (cur);
                        stack.push_back (cur);
                }
                if (cur > 10000)
                        break;
        }
}
int
main()
{
        for (int i = 0; i < 10000; i++)
          test();
}

Reply via email to