Summary: | two copies of a constant in two different registers | ||
---|---|---|---|
Product: | gcc | Reporter: | Andrew Pinski <pinskia> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | gcc-bugs, pawel_sikora, steven |
Priority: | P3 | Keywords: | missed-optimization |
Version: | 4.1.0 | ||
Target Milestone: | --- | ||
Host: | Target: | i686-pc-linux-gnu | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2007-07-01 00:38:11 | |
Bug Depends on: | |||
Bug Blocks: | 16996 |
Description
Andrew Pinski
2005-11-03 01:15:13 UTC
on x86-64 I get: f: movl i.0(%rip), %eax testl %eax, %eax jne .L2 movb $2, %al movl $2, i.0(%rip) .L2: rep ; ret $ pr24647.c.t97.final_cleanup f() { static int i; int i1; static int i; <bb 0>: i1 = i; if (i1 == 0) goto <L0>; else goto <L1>; <L0>:; i = 2; i1 = 2; <L1>:; return i1; } (In reply to comment #1) > on x86-64 I get: That is what I get on x86 also now: f: movl i.1523, %eax pushl %ebp movl %esp, %ebp testl %eax, %eax jne .L2 movl $2, i.1523 movb $2, %al .L2: popl %ebp ret But just change "== 0" to "!= 0" and you get the problem still. Also this is a code size issue for -Os as movl with a constant takes up too much space. Trunk today: f(): movl f()::i, %eax testl %eax, %eax jne .L1 # or je for the != case movl $2, f()::i movl $2, %eax .L1: ret |