Bug 34378 - [autovectorize]: missed optimization
Summary: [autovectorize]: missed optimization
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.2
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Blocks: restrict vectorizer
  Show dependency treegraph
Reported: 2007-12-07 11:42 UTC by tim blechmann
Modified: 2013-03-27 11:48 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description tim blechmann 2007-12-07 11:42:37 UTC
in the following code, first function is vectorized, while the second one is not:

typedef float aligned_float  __attribute__((aligned(4 * sizeof(float))));
typedef aligned_float * __restrict__ restricted_float_ptr;

void test(int n, restricted_float_ptr in, restricted_float_ptr out)
    for (int i = 0; i != n; ++i)
        out[i] = in[i] + 1.f;

void test2(int n, aligned_float * inarg, aligned_float * outarg)
    restricted_float_ptr in = inarg;
    restricted_float_ptr out = outarg;

    for (int i = 0; i != n; ++i)
        out[i] = in[i] + 1.f;
Comment 1 Andrew Pinski 2007-12-09 02:09:22 UTC
I think this is the same issue as PR 16306.
Comment 2 Richard Biener 2012-07-13 08:39:02 UTC
Link to vectorizer missed-optimization meta-bug.
Comment 3 Richard Biener 2013-03-27 11:48:50 UTC
Both loops are vectorized now, the one in test2 with a runtime check for
alias though.


Link to restrict meta-bug.