https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119274
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2025-03-13 00:00:00 |
CC| |pinskia at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For:
```
#include <vector>
typedef std::vector<int> v1;
static
void drop_inplace(v1 & c, size_t len)
{
if (len <= c.size())
c[len-1] = 0;
}
void func(){
v1 vec1{1,2,3,4,5,6};
drop_inplace(vec1, 10);
}
```
fre3 has:
```
Value numbering stmt = _27 = PHI <0B(4), _35(9)>
Setting value number of _27 to _35 (changed)
_35 is available for _35
...
Value numbering stmt = __result_28 = _27 + _17;
Setting value number of _6 to __result_28 (changed)
Making available beyond BB14 _6 for value __result_28
Setting value number of _4 to _35 (changed)
Making available beyond BB14 _4 for value _35
Value numbering stmt = _9 = _6 - _4;
Setting value number of _9 to _9 (changed)
```
_9 should have been matched-and-simplified to `_17` during fre3 but seemly we
miss that _35's value is the same as _27. I have not debugged further than that
yet.