This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/21887] New: missed optimization with globals
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jun 2005 19:56:33 -0000
- Subject: [Bug rtl-optimization/21887] New: missed optimization with globals
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the following code we produce an extra la.
int curr_state_graph_pass_num = 0;
void
pass_states (void)
{
curr_state_graph_pass_num++;
}
We currently produce at -O2 -mdynamic-no-pic:
_pass_states:
lis r9,ha16(_curr_state_graph_pass_num)
la r9,lo16(_curr_state_graph_pass_num)(r9)
lwz r2,0(r9)
addi r2,r2,1
stw r2,0(r9)
blr
We should be able to produce the following instead:
_pass_states:
lis r9,ha16(_curr_state_graph_pass_num)
lwz r2,lo16(_curr_state_graph_pass_num)(r9)
addi r2,r2,1
stw r2,lo16(_curr_state_graph_pass_num)(r9)
blr
--
Summary: missed optimization with globals
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: minor
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21887