https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83194
Bug ID: 83194
Summary: Possibly missed simplification with strcmp(s, t) ==
strcmp(t, s)
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: prathamesh3492 at gcc dot gnu.org
Target Milestone: ---
Hi,
FRE transforms
_1 = strcmp(s, t)
_2 = strcmp(s, t)
return _1 == _2
to:
return 1
However it does't transform if
_2 = strcmp(t, s)
I assume strcmp(s, t) == -strcmp(t, s) ?
Would it be safe to transform to following ?
_1 = strcmp (s, t)
_2 = -_1
return _1 == _2
Thanks,
Prathamesh