Bug 57811 - Wasted work in find_reloads()
Summary: Wasted work in find_reloads()
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-03 19:08 UTC by Po-Chun Chang
Modified: 2013-07-23 15:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Suggested patch for loop at line 3324 (347 bytes, text/plain)
2013-07-03 20:29 UTC, Po-Chun Chang
Details
Suggested patch for loop at line 3324 (202 bytes, patch)
2013-07-03 20:43 UTC, Po-Chun Chang
Details | Diff
Suggested patch for loop at line 4641 (233 bytes, patch)
2013-07-03 20:43 UTC, Po-Chun Chang
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Po-Chun Chang 2013-07-03 19:08:19 UTC
The problem appears in revision 200588 in version 4.9.

In method "find_reloads()" in gcc/reload.c, the loop on line 3324  should break immediately after "badop" is set to "1". All the iterations after "badop" set to "1" do not perform any useful work, at best they just set "badop" again to "1".

Similar problem also appears in the same method "find_reloads()" in line 4641. The loop should break immediately after "ok" is set to "0".
Comment 1 Po-Chun Chang 2013-07-03 20:29:15 UTC
Created attachment 30442 [details]
Suggested patch for loop at line 3324
Comment 2 Po-Chun Chang 2013-07-03 20:43:08 UTC
Created attachment 30444 [details]
Suggested patch for loop at line 3324
Comment 3 Po-Chun Chang 2013-07-03 20:43:30 UTC
Created attachment 30445 [details]
Suggested patch for loop at line 4641
Comment 4 Po-Chun Chang 2013-07-22 16:40:41 UTC
Patch sent to gcc-patches@

http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00930.html
Comment 5 Jeffrey A. Law 2013-07-23 15:57:01 UTC
Fixed in mainline.