https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127356
Bug ID: 127356
Summary: Need a version of overflow_free_p which does not
assume TYPE_OVERFLOW_UNDEFINED
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: internal-improvement, missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Currently I am adding a pattern for:
/* minmax (a, b) + c -> minmax (a + c, b + c)
if a+c or b+c simplifies and a+c/b+c don't overlfow */
But this has to be limited to TYPE_UNSIGNED (really it could be
!TYPE_OVERFLOW_UNDEFINED but I used unsigned since that is the case I am
looking into) due to the overflow_free_p assumes if the type has undefined
overflow, then it we can't overflow. But in this case I am checking to make
sure we don't introduce any new overflows.
This is also mentioned here:
https://inbox.sourceware.org/gcc-patches/CAFiYyc0FbXf4Z=8-yX65y5=feoxtvtuguprvky7bhu8o2i8...@mail.gmail.com/T/#u