https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125945
Bug ID: 125945
Summary: factor_out_conditional_load could use better heurstic
for pre-vectorization
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Right now the heurstics is very simple:
```
/* Factoring out a load during the first phi means we can't
trust if this is inside a loop or not; due to before inlining. */
if (early_p)
return false;
/* Before vectorization, we don't want to factor out loads unless not inside
a loop. */
if (before_vect && bb_loop_depth (merge) != 0)
return false;
```
One thing is if the load is from the same address, then it can be factored out
even early_p.
There might be other ones which might be wanted to do always and/or before
vectorization. But I am blanking at this point.
Note decl load ones are only after vectorization due to phiprop back and forth.