https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112706

            Bug ID: 112706
           Summary: missed simplification in FRE
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Compiling the following testcase (simplified from repeated
std::vector::push_back expansion):

int *ptr;
void link_error ();
void
test ()
{

        int *ptr1 = ptr + 10;
        int *ptr2 = ptr + 20;
        if (ptr1 == ptr2)
                link_error ();
}

with gcc -O2 t.C -fdump-tree-all-details
one can check that link_error is optimized away really late:

jh@ryzen4:/tmp> grep link_error a-t.C*
....
a-t.C.106t.cunrolli:  link_error ();
a-t.C.107t.backprop:  link_error ();
a-t.C.108t.phiprop:  link_error ();
a-t.C.109t.forwprop2:link_error ();

this is too late for some optimization to catch up (in the case of std::vector
we end up missing DSE since the transform is delayed to forwprop3)

I think this is something value numbering should catch.

Reply via email to