From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24743 invoked by alias); 2 Feb 2015 10:44:44 -0000 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 Received: (qmail 24681 invoked by uid 48); 2 Feb 2015 10:44:40 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/64756] [5 Regression] wrong code at -O3 on x86_64-linux-gnu (in 32-bit mode) Date: Mon, 02 Feb 2015 10:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00099.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64756 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu.org, | |jakub at gcc dot gnu.org, | |law at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- No idea what this has to do with wide_int, I don't see any relation (unfortunately my r210112 and r210113 copies are without debug info at this point). But, it really seems to be a CSE bug to me (during cse2). The thing is, in insn 29 tmp is stored to using volatile store: (insn 29 27 30 7 (set (mem/v/f/c:SI (symbol_ref:SI ("tmp") ) [1 MEM[(int * volatile *)&tmp]+0 S4 A32]) (const_int 0 [0])) pr64756.c:19 90 {*movsi_internal} (nil)) but when the hash of dest is computed, we actually use: if (MEM_P (dest)) { #ifdef PUSH_ROUNDING /* Stack pushes invalidate the stack pointer. */ rtx addr = XEXP (dest, 0); if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC && XEXP (addr, 0) == stack_pointer_rtx) invalidate (stack_pointer_rtx, VOIDmode); #endif dest = fold_rtx (dest, insn); } /* Compute the hash code of the destination now, before the effects of this instruction are recorded, since the register values used in the address computation are those before this instruction. */ sets[i].dest_hash = HASH (dest, mode); and so dest is folded first into symbol_ref ("a"). That means when computing hash we do not get do_not_record flag set, which we would otherwise get because the memory is volatile, nor we do get the hash_arg_in_memory flag set. Next we recompute the hash, but do not look at do_not_record anymore: if (sets[i].rtl != 0 && dest != SET_DEST (sets[i].rtl)) sets[i].dest_hash = HASH (SET_DEST (sets[i].rtl), mode); Later on we insert this mem/v/f/c into the hash table and set the in_memory flag (correctly): elt->in_memory = (MEM_P (sets[i].inner_dest) && !MEM_READONLY_P (sets[i].inner_dest)); Later on merge_equiv_classes is called, and that one obviously doesn't count with the option that do_not_record might be true, and when we set do_not_record, we don't set hash_arg_in_memory, so we end up with a new elt that for the MEM at this time doesn't even have in_memory flag set, so when we later in insn 36 store into memory that aliases with this, we do not even invalidate it.