optimization/4919: gcse inhibits loop optimization

ottoni@ic.unicamp.br ottoni@ic.unicamp.br
Sun Nov 11 22:56:00 GMT 2001


>Number:         4919
>Category:       optimization
>Synopsis:       gcse inhibits loop optimization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 21 06:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Guilherme Ottoni
>Release:        gcc version 3.1 20011029 (experimental)
>Organization:
>Environment:
RedHat Linux 6.2 running on a PC (K6-II)
>Description:
Compiling with gcc -O2 the source attached, the loop optimizer fails to detect 
BIVs, and so misses the opportunity to apply all the loop 
optimizations. If you add the -no-gcse flag to the command line,
the loop optimizer works properly.
To check what the loop optimizer is doing, I'm looking at 
the debug file generated by -dL.
>How-To-Repeat:
Simply compile the source attached, with -O2, and with and 
without the -fno-gcse. Then look at the .loop debug files to
check the problem.
I'm using a dsp16xx target, but I think this problem will occur 
with any target, as it is before the backend.
>Fix:
Maybe enhancing the BIV detection method to get the BIVs in 
these cases. Another (dirty) solution would be to inhibit the 
GCSE to optimize the code in the LOOP_CONT.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="cc2001.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="cc2001.c"

bWFpbigpCnsKICBpbnQgIGksIGF2ZywgYVsxMDBdLCBlcnJvcjsKICBmb3IgKGk9MDsgaSA8IDkw
OyBpKyspCiAgewogICAgaWYgKGklMikKICAgIHsgCiAgICAgIGF2ZyArPSBhW2krMV0gPDwgMjsK
ICAgICAgYVtpKzJdID0gYXZnICogMzsKICAgIH0KICAgIGlmIChhdmcgPCBlcnJvcikKICAgICAg
YXZnIC09IGFbaSsxXSAtIGVycm9yLzI7CiAgICBlbHNlCiAgICAgIGF2ZyAtPSBhW2krMl0gLSBl
cnJvcjsKICB9Cn0KCg==



More information about the Gcc-bugs mailing list