optimization/7270: Redundant compares not eliminated on x86.

anamax@earthlink.net anamax@earthlink.net
Wed Jul 10 23:33:00 GMT 2002


>Number:         7270
>Category:       optimization
>Synopsis:       Redundant compares not eliminated on x86.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 10 22:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andy Freeman
>Release:        gcc 3.1
>Organization:
>Environment:
Redhat 7.3
>Description:
A <= compare&branch followed by a == test on the same arguments uses a redundant compare for the == on x86.

Using built-in specs.
Configured with: ../gcc-3.1/configure 
Thread model: single
gcc version 3.1
>How-To-Repeat:
Look at the -O3 -S output for x86.  Notice the two cmpls on either side of the "ja .L4".  I believe that the second cmpl is unnecessary as the flags from the first should survive the "ja .L4".
>Fix:
Better value propagation.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="ii.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ii.cc"

dW5zaWduZWQgZm9vKHVuc2lnbmVkIGFbXSkgew0KICBmb3IoIHVuc2lnbmVkIGkgPSAwOyBpIDwg
MTA7ICsraSApIHsNCiAgICBpZiggaSA8PSBhW2ldICkgew0KICAgICAgaWYoIGkgPT0gYVtpXSAp
IHsNCglyZXR1cm4gOTsNCiAgICAgIH0gZWxzZSB7DQoJcmV0dXJuIDE1Ow0KICAgICAgfQ0KICAg
IH0NCiAgfQ0KfQ0K



More information about the Gcc-bugs mailing list