Bug 34378

Summary: [autovectorize]: missed optimization
Product: gcc Reporter: tim blechmann <tim>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: enhancement CC: gcc-bugs
Priority: P3    
Version: 4.2.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 49774, 53947    

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 Drea 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.

Fixed.

Link to restrict meta-bug.