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

            Bug ID: 90917
           Summary: Propagate constants into loads if dominated by
                    str(n)cmp/memcmp
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.bolvansky at gmail dot com
  Target Milestone: ---

Motivation:

char f(char* s) {
  if (strcmp(s, "test") == 0) return s[0];
  return '-';
}

--->

char f2(char* s) {
  if (strcmp(s, "test") == 0) return 't';
  return '-';
}

Reply via email to