GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 35345 - Scalar replacement to handle output dependence
Summary: Scalar replacement to handle output dependence
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2008-02-24 04:40 UTC by davidxl
Modified: 2008-12-29 06:18 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-12-29 06:18:38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description davidxl 2008-02-24 04:40:22 UTC
// David Li
Gcc's scalar replacement and predictive commoning implementation is very good. There are some missing cases. Handling output dependence is one of them.

Handling of output dependence. In this case, the store at (1) is dead except for the last iteration -- it should be sinked out of the loop. (-O3 -fno-tree-vectorize)

int a[1000];
int b[1000];

void foo(int n)
{
   int i = 1;
   for(; i < n; i++)
   {
        a[i+1] =i;     // (1) 
        a[i] = i+1;
   }
}
Comment 1 Andrew Pinski 2008-04-07 01:38:45 UTC
Confirmed.