https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117056
Bug ID: 117056 Summary: Assume vs vectorizer Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Blocks: 53947 Target Milestone: --- Take (not fully realistic example but mainly to show how assume statements can get in the way): ``` static inline int f(int a, int *c) { int d; if (a > 0) { [[assume(*c == 0)]]; d = a; } else { [[assume(*c != 0)]]; d = -a; } return d; } void g(int *d, int l, int *e) { for(int i = 0; i < l; i++) { d[i] = f(d[i], &e[i]); } } void g1(int *d, int l, int *e) { for(int i = 0; i < l; i++) { [[assume(e[i] == 0)]]; d[i] = d[i] + 1; } } ``` Right now g does not get vectorized as phiopt/ifcvt does not handle ASSUME statements in a reasonible fashion. g1 does get vectorized BUT the assume statement and the scalar induction variable stays around and the induction variable selection is a bit odd. Maybe this should be a few seperate bug reports or maybe this could be the meta-bug around assume statements. Anyways since assume is new the code quality to adding assume might be a few years off though. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations