public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/26537] New: Basic block reordering inserts redundant instruction
@ 2006-03-03 1:56 dann at godzilla dot ics dot uci dot edu
2006-03-03 2:05 ` [Bug rtl-optimization/26537] " pinskia at gcc dot gnu dot org
2006-03-03 2:08 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-03-03 1:56 UTC (permalink / raw)
To: gcc-bugs
This code:
extern char *nl_langinfo (int) __attribute__ ((__nothrow__));
char *
xtermEnvEncoding(void)
{
static char *result;
if (result == 0)
result = nl_langinfo(50);
return result;
}
gets compile by gcc-4.1.0 -march=i686 -mtune=i686 to:
xtermEnvEncoding:
[snip]
.L6:
movl $50, (%esp)
call nl_langinfo
movl %eax, result.1281
movl result.1281, %eax <---- note this
leave
ret
Note the redundant mov instruction. 4.0 does not generate that extra
instruction.
The extra instruction seems to be generated by the bbro pass. Here is the RTL
dump for the .44.rnreg pass: nothing unusual
(call_insn:HI 17 16 19 1 (set (reg:SI 0 ax)
(call (mem:QI (symbol_ref:SI ("nl_langinfo") [flags 0x41]
<function_decl 0xb7f2f100
nl_langinfo>) [0 S1 A8])
(const_int 4 [0x4]))) 531 {*call_value_0} (nil)
(expr_list:REG_EH_REGION (const_int 0 [0x0])
(nil))
(nil))
(insn:HI 19 17 20 1 (set (mem/f/c/i:SI (symbol_ref:SI ("result.1281") [flags
0x2] <var_decl
0xb7ebb108 result>) [2 result+0 S4 A32])
(reg:SI 0 ax [orig:58 D.1283 ] [58])) 34 {*movsi_1}
(insn_list:REG_DEP_TRUE 18 (nil
))
(expr_list:REG_DEAD (reg:SI 0 ax [orig:58 D.1283 ] [58])
(nil)))
but the next dump, .45.bbro shows that an extra move instruction has been
inserted.
(call_insn:HI 17 16 19 2 (set (reg:SI 0 ax)
(call (mem:QI (symbol_ref:SI ("nl_langinfo") [flags 0x41]
<function_decl 0xb7f2f100
nl_langinfo>) [0 S1 A8])
(const_int 4 [0x4]))) 531 {*call_value_0} (nil)
(expr_list:REG_EH_REGION (const_int 0 [0x0])
(nil))
(nil))
(insn:HI 19 17 54 2 (set (mem/f/c/i:SI (symbol_ref:SI ("result.1281") [flags
0x2] <var_decl
0xb7ebb108 result>) [2 result+0 S4 A32])
(reg:SI 0 ax [orig:58 D.1283 ] [58])) 34 {*movsi_1}
(insn_list:REG_DEP_TRUE 18 (nil
))
(expr_list:REG_DEAD (reg:SI 0 ax [orig:58 D.1283 ] [58])
(nil)))
(insn 54 19 55 2 (set (reg/f:SI 0 ax [orig:61 result ] [61])
(mem/f/c/i:SI (symbol_ref:SI ("result.1281") [flags 0x2] <var_decl
0xb7ebb108 resul
t>) [2 result+0 S4 A32])) 34 {*movsi_1} (nil)
(nil))
This problem is one of the causes for PR23153.
--
Summary: Basic block reordering inserts redundant instruction
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26537
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/26537] Basic block reordering inserts redundant instruction
2006-03-03 1:56 [Bug rtl-optimization/26537] New: Basic block reordering inserts redundant instruction dann at godzilla dot ics dot uci dot edu
@ 2006-03-03 2:05 ` pinskia at gcc dot gnu dot org
2006-03-03 2:08 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 2:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-03-03 02:05 -------
This was already reported once before, this is a dup of bug 23488.
*** This bug has been marked as a duplicate of 23488 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26537
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/26537] Basic block reordering inserts redundant instruction
2006-03-03 1:56 [Bug rtl-optimization/26537] New: Basic block reordering inserts redundant instruction dann at godzilla dot ics dot uci dot edu
2006-03-03 2:05 ` [Bug rtl-optimization/26537] " pinskia at gcc dot gnu dot org
@ 2006-03-03 2:08 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 2:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-03-03 02:08 -------
The problem has nothing to do with basic block reordering anyways. It is just
copying instructions and not optimizing them.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26537
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-03 2:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-03 1:56 [Bug rtl-optimization/26537] New: Basic block reordering inserts redundant instruction dann at godzilla dot ics dot uci dot edu
2006-03-03 2:05 ` [Bug rtl-optimization/26537] " pinskia at gcc dot gnu dot org
2006-03-03 2:08 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).