From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4371 invoked by alias); 19 May 2010 09:39:05 -0000 Received: (qmail 4305 invoked by uid 48); 19 May 2010 09:38:49 -0000 Date: Wed, 19 May 2010 09:39:00 -0000 Message-ID: <20100519093849.4304.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/44194] struct returned by value generates useless stores In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg01989.txt.bz2 ------- Comment #1 from rguenth at gcc dot gnu dot org 2010-05-19 09:38 ------- Confirmed. We already expand it that way: ;; s = foo (); (insn 5 4 6 t.c:7 (set (reg:QI 0 ax) (const_int 0 [0x0])) -1 (nil)) (call_insn 6 5 7 t.c:7 (set (parallel:BLK [ (expr_list:REG_DEP_TRUE (reg:DI 0 ax) (const_int 0 [0x0])) (expr_list:REG_DEP_TRUE (reg:DI 1 dx) (const_int 8 [0x8])) ]) (call (mem:QI (symbol_ref:DI ("foo") [flags 0x41] ) [0 S1 A8]) (const_int 0 [0x0]))) -1 (nil) (expr_list:REG_DEP_TRUE (use (reg:QI 0 ax)) (nil))) (insn 7 6 8 t.c:7 (set (reg:DI 60) (reg:DI 0 ax)) -1 (nil)) (insn 8 7 9 t.c:7 (set (reg:DI 61) (reg:DI 1 dx)) -1 (nil)) (insn 9 8 10 t.c:7 (set (mem/s/c:DI (plus:DI (reg/f:DI 54 virtual-stack-vars) (const_int -32 [0xffffffffffffffe0])) [2 S8 A128]) (reg:DI 60)) -1 (nil)) (insn 10 9 11 t.c:7 (set (mem/s/c:DI (plus:DI (reg/f:DI 54 virtual-stack-vars) (const_int -24 [0xffffffffffffffe8])) [2 S8 A64]) (reg:DI 61)) -1 (nil)) (insn 11 10 12 t.c:7 (set (reg:DI 62) (mem/s/c:DI (plus:DI (reg/f:DI 54 virtual-stack-vars) (const_int -32 [0xffffffffffffffe0])) [2 S8 A128])) -1 (nil)) (insn 12 11 13 t.c:7 (set (mem/s/c:DI (plus:DI (reg/f:DI 54 virtual-stack-vars) (const_int -16 [0xfffffffffffffff0])) [2 s+0 S8 A128]) (reg:DI 62)) -1 (nil)) (insn 13 12 14 t.c:7 (set (reg:DI 63) (mem/s/c:DI (plus:DI (reg/f:DI 54 virtual-stack-vars) (const_int -24 [0xffffffffffffffe8])) [2 S8 A64])) -1 (nil)) (insn 14 13 0 t.c:7 (set (mem/s/c:DI (plus:DI (reg/f:DI 54 virtual-stack-vars) (const_int -8 [0xfffffffffffffff8])) [2 s+8 S8 A64]) (reg:DI 63)) -1 (nil)) So we create a stack representation to copy it to the stack temporary (which both are unneeded). We should see that we can avoid the temporary at all as there is no aggregate use of the struct left. At least we should avoid the 2nd temporary. I'm very sure there is a duplicate for this bug somewhere. Also I wonder why RTL DSE cannot remove all the stores to the stack. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matz at gcc dot gnu dot org Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2010-05-19 09:38:49 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44194