* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-01 11:59 ` jakub at gcc dot gnu.org
2011-04-16 11:02 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-10-01 11:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.4.5 |4.4.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 11:59 ` [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination jakub at gcc dot gnu.org
@ 2011-04-16 11:02 ` jakub at gcc dot gnu.org
2011-04-16 11:29 ` jingyu at google dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-16 11:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.4.6 |4.4.7
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 11:59 ` [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination jakub at gcc dot gnu.org
2011-04-16 11:02 ` jakub at gcc dot gnu.org
@ 2011-04-16 11:29 ` jingyu at google dot com
2011-05-13 19:46 ` lacombar at gmail dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: jingyu at google dot com @ 2011-04-16 11:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
--- Comment #12 from Jing Yu <jingyu at google dot com> 2011-04-16 10:36:27 UTC ---
I am on leave from 02/01/2011 to 05/30/2011. I may not reply your
email during this period.
If you have Android toolchain questions/issues/requests, please
contact Doug (dougkwan@google.com) or my manager Bhaskar
(bjanakiraman@google.com).
Thanks,
Jing
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-04-16 11:29 ` jingyu at google dot com
@ 2011-05-13 19:46 ` lacombar at gmail dot com
2011-05-13 20:19 ` jingyu at google dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: lacombar at gmail dot com @ 2011-05-13 19:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
Arnaud Lacombe <lacombar at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lacombar at gmail dot com
--- Comment #13 from Arnaud Lacombe <lacombar at gmail dot com> 2011-05-13 19:26:40 UTC ---
It would seem that GCC 4.5.1 is still generating a call to func(), at -Os.
Considering the following reduced test-case:
extern int outcnt;
void test ()
{
outcnt = 0;
if (outcnt == 1) func ();
if (outcnt == 1) func ();
if (outcnt == 1) func ();
if (outcnt == 1) func ();
if (outcnt == 1) func ();
if (outcnt == 1) func ();
if (outcnt == 1) func ();
if (outcnt == 1) func ();
}
At -O2:
/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/cc1 -O2 -o - test.c
.file "test.c"
test
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <early_local_cleanups> <whole-program> <cp>
<inline> <static-var> <pure-const>Assembling functions:
test .text
.p2align 4,,15
.globl test
.type test, @function
test:
.LFB0:
.cfi_startproc
movl $0, outcnt(%rip)
ret
.cfi_endproc
.LFE0:
.size test, .-test
.ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)"
.section .note.GNU-stack,"",@progbits
Now, at -Os:
/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/cc1 -Os -o - test.c
.file "test.c"
test
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <early_local_cleanups> <whole-program> <cp>
<inline> <static-var> <pure-const>Assembling functions:
test .text
.globl test
.type test, @function
test:
.LFB0:
.cfi_startproc
movl $0, outcnt(%rip)
cmpl $1, outcnt(%rip)
jne .L1
xorl %eax, %eax
jmp func
.L1:
ret
.cfi_endproc
.LFE0:
.size test, .-test
.ident "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)"
.section .note.GNU-stack,"",@progbits
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-05-13 19:46 ` lacombar at gmail dot com
@ 2011-05-13 20:19 ` jingyu at google dot com
2011-05-13 20:51 ` lacombar at gmail dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: jingyu at google dot com @ 2011-05-13 20:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
--- Comment #14 from Jing Yu <jingyu at google dot com> 2011-05-13 19:34:35 UTC ---
I am on leave from 02/01/2011 to 05/30/2011. I may not reply your
email during this period.
If you have Android toolchain questions/issues/requests, please
contact Doug (dougkwan@google.com) or my manager Bhaskar
(bjanakiraman@google.com).
Thanks,
Jing
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2011-05-13 20:19 ` jingyu at google dot com
@ 2011-05-13 20:51 ` lacombar at gmail dot com
2011-05-18 11:21 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: lacombar at gmail dot com @ 2011-05-13 20:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
--- Comment #15 from Arnaud Lacombe <lacombar at gmail dot com> 2011-05-13 20:14:08 UTC ---
trunk from early May also fails with one more "if (outcnt == 1) func ();" line
at the end of the function:
% ./gcc/cc1 -Os -o - test.c
.file "test.c"
test
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <early_local_cleanups> <whole-program>
<ipa-profile> <cp> <inline> <pure-const> <static-var>Assembling functions:
test .text
.globl test
.type test, @function
test:
.LFB0:
.cfi_startproc
movl $0, outcnt(%rip)
cmpl $0, outcnt(%rip)
je .L1
xorl %eax, %eax
jmp func
.L1:
ret
.cfi_endproc
.LFE0:
.size test, .-test
.ident "GCC: (GNU) 4.7.0 20110416 (experimental)"
.section .note.GNU-stack,"",@progbits
Target and host are x86-64-linux. -O2 and above are fine.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2011-05-13 20:51 ` lacombar at gmail dot com
@ 2011-05-18 11:21 ` rguenth at gcc dot gnu.org
2011-05-18 11:46 ` jingyu at google dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-18 11:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |
--- Comment #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-18 10:48:08 UTC ---
I don't see any calls to func() for the original testcase that survive at
-O2 or -Os for 4.5, 4.6 and current trunk.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2011-05-18 11:21 ` rguenth at gcc dot gnu.org
@ 2011-05-18 11:46 ` jingyu at google dot com
2011-05-18 15:29 ` lacombar at gmail dot com
2012-03-13 16:01 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 22+ messages in thread
From: jingyu at google dot com @ 2011-05-18 11:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
--- Comment #17 from Jing Yu <jingyu at google dot com> 2011-05-18 11:06:35 UTC ---
I am on leave from 02/01/2011 to 05/30/2011. I may not reply your
email during this period.
If you have Android toolchain questions/issues/requests, please
contact Doug (dougkwan@google.com) or my manager Bhaskar
(bjanakiraman@google.com).
Thanks,
Jing
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2011-05-18 11:46 ` jingyu at google dot com
@ 2011-05-18 15:29 ` lacombar at gmail dot com
2012-03-13 16:01 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 22+ messages in thread
From: lacombar at gmail dot com @ 2011-05-18 15:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
--- Comment #18 from Arnaud Lacombe <lacombar at gmail dot com> 2011-05-18 15:17:48 UTC ---
Yes, the original test case is fine now, but not the updated snippet I posted.
Maybe should I open a new bug ?
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
[not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2011-05-18 15:29 ` lacombar at gmail dot com
@ 2012-03-13 16:01 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-13 16:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |FIXED
Target Milestone|4.4.7 |4.5.0
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 13:04:09 UTC ---
Fixed in 4.5+, 4.4 is no longer supported.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
@ 2009-12-30 23:21 ` rguenth at gcc dot gnu dot org
2009-12-30 23:34 ` rguenth at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-30 23:21 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
2009-12-30 23:21 ` [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination rguenth at gcc dot gnu dot org
@ 2009-12-30 23:34 ` rguenth at gcc dot gnu dot org
2009-12-31 15:36 ` rguenth at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-30 23:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2009-12-30 23:34 -------
The issue is that we do not do predicated value-numbering so we need multiple
invocations of it. Which all of FRE, DOM and PRE do - but PRE is not run at
-Os in 4.4.
And yes, the optimization done by 4.5 is correct.
You could say "fixed" in 4.5 - or wait for someone to implement predicated
value-numbering to also fix a testcase with one more if (outcnt == 1) func ();
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
2009-12-30 23:21 ` [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination rguenth at gcc dot gnu dot org
2009-12-30 23:34 ` rguenth at gcc dot gnu dot org
@ 2009-12-31 15:36 ` rguenth at gcc dot gnu dot org
2010-01-07 9:19 ` sliao at google dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-31 15:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenth at gcc dot gnu dot org 2009-12-31 15:36 -------
Btw, in 4.4 there is one DOM pass removed for compile-time.
We won't fix this for 4.4, the particular testcase is fixed in 4.5.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to fail| |4.4.3
Known to work|4.2.1 |4.2.1 4.5.0
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (2 preceding siblings ...)
2009-12-31 15:36 ` rguenth at gcc dot gnu dot org
@ 2010-01-07 9:19 ` sliao at google dot com
2010-01-07 9:49 ` steven at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: sliao at google dot com @ 2010-01-07 9:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from sliao at google dot com 2010-01-07 09:18 -------
For the trunk snapshot of 20100102, GCC 4.5.0 indeed removes most of the
redundancy. However, -O1 and -Os still produce an extra instruction, while -O2
doesn't. Do we care about an extra instruction below? Thanks.
The instruction is marked as "redundant" below.
GCC trunk's -Os:
Disassembly of section .text:
00000000 <test>:
0: e59f3024 ldr r3, [pc, #36] ; 2c <test+0x2c>
4: e3a02000 mov r2, #0
8: e5832000 str r2, [r3]
c: e59f301c ldr r3, [pc, #28] ; 30 <test+0x30>
10: e5932000 ldr r2, [r3]
14: e59f3018 ldr r3, [pc, #24] ; 34 <test+0x34>
18: e3520000 cmp r2, #0
1c: 13a02002 movne r2, #2
20: 03a02000 moveq r2, #0 ;redundant
24: e5c32000 strb r2, [r3]
28: e12fff1e bx lr
...
GCC trunk's -O1:
Disassembly of section .text:
00000000 <test>:
0: e3a02000 mov r2, #0
4: e59f3020 ldr r3, [pc, #32] ; 2c <test+0x2c>
8: e5832000 str r2, [r3]
c: e59f301c ldr r3, [pc, #28] ; 30 <test+0x30>
10: e5932000 ldr r2, [r3]
14: e3520000 cmp r2, #0
18: 13a02002 movne r2, #2
1c: 03a02000 moveq r2, #0 ;redundant
20: e59f300c ldr r3, [pc, #12] ; 34 <test+0x34>
24: e5c32000 strb r2, [r3]
28: e12fff1e bx lr
...
Below, GCC trunk's -O2 doesn't produce the redundant instruction.
-O2:
Disassembly of section .text:
00000000 <test>:
0: e59f3020 ldr r3, [pc, #32] ; 28 <test+0x28>
4: e59f2020 ldr r2, [pc, #32] ; 2c <test+0x2c>
8: e5933000 ldr r3, [r3]
c: e3a01000 mov r1, #0
10: e3530000 cmp r3, #0
14: e5821000 str r1, [r2]
18: e59f2010 ldr r2, [pc, #16] ; 30 <test+0x30>
1c: 13a03002 movne r3, #2
20: e5c23000 strb r3, [r2]
24: e12fff1e bx lr
...
--
sliao at google dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jingyu at google dot com,
| |dougkwan at google dot com,
| |carrot at google dot com
Status|RESOLVED |REOPENED
Resolution|WONTFIX |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (3 preceding siblings ...)
2010-01-07 9:19 ` sliao at google dot com
@ 2010-01-07 9:49 ` steven at gcc dot gnu dot org
2010-01-07 21:30 ` steven at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-01-07 9:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from steven at gcc dot gnu dot org 2010-01-07 09:49 -------
*sigh* With all the Google power, why can't anyone there try to debug this?
I'll have a look.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |steven at gcc dot gnu dot
|dot org |org
Status|REOPENED |ASSIGNED
Last reconfirmed|2009-12-29 10:35:21 |2010-01-07 09:49:13
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (4 preceding siblings ...)
2010-01-07 9:49 ` steven at gcc dot gnu dot org
@ 2010-01-07 21:30 ` steven at gcc dot gnu dot org
2010-01-07 21:36 ` steven at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-01-07 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from steven at gcc dot gnu dot org 2010-01-07 21:29 -------
The diff between -O2 and -Os starts in combine:
diff -ur O2/t.c.175r.combine Os/t.c.175r.combine
--- O2/t.c.175r.combine 2010-01-07 22:24:04.000000000 +0100
+++ Os/t.c.175r.combine 2010-01-07 22:23:14.000000000 +0100
@@ -4,18 +4,20 @@
starting the processing of deferred insns
ending the processing of deferred insns
df_analyze called
-insn_cost 7: 12
+insn_cost 7: 8
insn_cost 8: 4
insn_cost 9: 4
-insn_cost 10: 12
-insn_cost 11: 12
+insn_cost 10: 8
+insn_cost 11: 4
insn_cost 12: 4
-insn_cost 46: 4
-insn_cost 17: 12
+insn_cost 46: 16
+insn_cost 17: 8
insn_cost 19: 4
-rejecting combination of insns 12 and 46
-original costs 4 + 4 = 8
-replacement cost 12
+deferring deletion of insn with uid = 12.
+modifying insn i3 46 {r133:SI={(r138:SI!=0x0)?0x2:0x0};clobber cc:CC;}
+ REG_UNUSED: cc:CC
+ REG_DEAD: r138:SI
+deferring rescan insn with uid = 46.
(note# 0 # 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(note# # # 2 NOTE_INSN_FUNCTION_BEG)
@@ -40,16 +42,17 @@
(expr_list:REG_EQUAL (mem/c/i:SI (symbol_ref:SI ("bool_var") [flags
0xc0] <var_decl # bool_var>) [2 bool_var+0 S4 A32])
(nil))))
-(insn# # # 2 t.c:13 (set (reg:CC 24 cc)
- (compare:CC (reg:SI 138 [ bool_var ])
- (const_int 0 [0x0])))# {*arm_cmpsi_insn} (nil))
-
-(insn# # # 2 t.c:8 (set (reg/v:SI 133 [ flags ])
- (if_then_else:SI (eq (reg:CC 24 cc)
- (const_int 0 [0x0]))
- (reg:SI 138 [ bool_var ])
- (const_int 2 [0x2])))# {*movsicc_insn} (expr_list:REG_DEAD (reg:SI
138 [ bool_var ])
- (expr_list:REG_DEAD (reg:CC 24 cc)
+(note# # # 2 NOTE_INSN_DELETED)
+
+(insn# # # 2 t.c:8 (parallel [
+ (set (reg/v:SI 133 [ flags ])
+ (if_then_else:SI (ne (reg:SI 138 [ bool_var ])
+ (const_int 0 [0x0]))
+ (const_int 2 [0x2])
+ (const_int 0 [0x0])))
+ (clobber (reg:CC 24 cc))
+ ])# {movcond} (expr_list:REG_UNUSED (reg:CC 24 cc)
+ (expr_list:REG_DEAD (reg:SI 138 [ bool_var ])
(nil))))
(insn# # # 2 t.c:14 (set (reg/f:SI 139)
@@ -60,7 +63,10 @@
(expr_list:REG_DEAD (reg/v:SI 133 [ flags ])
(nil))))
starting the processing of deferred insns
+deleting insn with uid = 12.
+rescanning insn with uid = 46.
+deleting insn with uid = 46.
ending the processing of deferred insns
-;; Combiner totals: 12 attempts, 12 substitutions (2 requiring new space),
-;; 0 successes.
+;; Combiner totals: 13 attempts, 13 substitutions (2 requiring new space),
+;; 1 successes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (5 preceding siblings ...)
2010-01-07 21:30 ` steven at gcc dot gnu dot org
@ 2010-01-07 21:36 ` steven at gcc dot gnu dot org
2010-01-07 22:08 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-01-07 21:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from steven at gcc dot gnu dot org 2010-01-07 21:36 -------
At -Os, in the .188r.postreload RTL dump:
(insn 46 12 17 2 t.c:8 (parallel [
(set (reg/v:SI 2 r2 [orig:133 flags ] [133])
(if_then_else:SI (ne (reg:SI 2 r2 [orig:138 bool_var ] [138])
(const_int 0 [0x0]))
(const_int 2 [0x2])
(const_int 0 [0x0])))
(clobber (reg:CC 24 cc))
]) 291 {movcond} (nil))
And one pass later, in the .190r.split2 RTL dump:
(insn 49 12 50 2 t.c:8 (set (reg:CC 24 cc)
(compare:CC (reg:SI 2 r2 [orig:138 bool_var ] [138])
(const_int 0 [0x0]))) 220 {*arm_cmpsi_insn} (nil))
(insn 50 49 51 2 t.c:8 (cond_exec (ne (reg:CC 24 cc)
(const_int 0 [0x0]))
(set (reg/v:SI 2 r2 [orig:133 flags ] [133])
(const_int 2 [0x2]))) 2367 {neon_vornv2di+77} (nil))
(insn 51 50 17 2 t.c:8 (cond_exec (eq (reg:CC 24 cc)
(const_int 0 [0x0]))
(set (reg/v:SI 2 r2 [orig:133 flags ] [133])
(const_int 0 [0x0]))) 2367 {neon_vornv2di+77} (nil))
There's your redundant mov, from an insn splitter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (6 preceding siblings ...)
2010-01-07 21:36 ` steven at gcc dot gnu dot org
@ 2010-01-07 22:08 ` steven at gcc dot gnu dot org
2010-01-07 22:08 ` steven at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-01-07 22:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from steven at gcc dot gnu dot org 2010-01-07 22:08 -------
An ARM maintainer can look at a solution for this (special splitters, maybe a
peephole2, perhaps a post-ce3 special DCE pass to clean up cond_exec silliness.
(See also bug 21803, for similar cond_exec idiocy on ia64.)
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rearnsha at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (7 preceding siblings ...)
2010-01-07 22:08 ` steven at gcc dot gnu dot org
@ 2010-01-07 22:08 ` steven at gcc dot gnu dot org
2010-01-21 13:19 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-01-07 22:08 UTC (permalink / raw)
To: gcc-bugs
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu dot
| |org
AssignedTo|steven at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (8 preceding siblings ...)
2010-01-07 22:08 ` steven at gcc dot gnu dot org
@ 2010-01-21 13:19 ` jakub at gcc dot gnu dot org
2010-02-08 16:45 ` steven at gcc dot gnu dot org
2010-04-30 8:58 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-01-21 13:19 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.4.3 |4.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (9 preceding siblings ...)
2010-01-21 13:19 ` jakub at gcc dot gnu dot org
@ 2010-02-08 16:45 ` steven at gcc dot gnu dot org
2010-04-30 8:58 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-02-08 16:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from steven at gcc dot gnu dot org 2010-02-08 16:45 -------
Trunk today (r156595) optimizes this at -O1, -Os, and -O2 in the tree
optimizers. The .fre pass removes the first func call, then .dom1 removes the
next two. The .dom2 pass removes the remaining one.
If I add another, say, 10 lines of "if (outcnt == 1) func ();", then dom1
removes them all (even with -fno-tree-fre).
So something changed in (or for) DOM that allows it to clean up this mess
completely. I would like to know what... Perhaps the OP can try to bisect to
identify what was changed here (in the hope that it is something that can be
back-ported to GCC 4.4)?
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
2009-12-25 5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
` (10 preceding siblings ...)
2010-02-08 16:45 ` steven at gcc dot gnu dot org
@ 2010-04-30 8:58 ` jakub at gcc dot gnu dot org
11 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-30 8:58 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.4.4 |4.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494
^ permalink raw reply [flat|nested] 22+ messages in thread