From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29498 invoked by alias); 10 Jan 2014 13:14:31 -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 28915 invoked by uid 48); 10 Jan 2014 13:14:26 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59747] [4.9 Regression] wrong code at -Os and above on x86_64-linux-gnu in 64-bit mode Date: Fri, 10 Jan 2014 13:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: 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: 4.9.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: 2014-01/txt/msg01087.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59747 --- Comment #6 from Jakub Jelinek --- The actual REGNO != REGNO transformation is correct, the problem is that the second extension is to a wider mode and while handling that we change the destination mode on the def_insn to an even wider mode. The code just assumes that the def insn sets the right REGNO rather than some other. So, I think it shouldn't be hard to detect that case. Then we either need to ensure the corresponding copy insn from the first extension will be adjusted to the wider mode, or for this case swap back the registers (revert to the original REGNO for the def insn and put the swap insn the other way around), or do it the other way around always (then no special casing would be needed; Jeff, what was the reason why you haven't handled (set (reg1) (expression)) (set (reg2) (any_extend (reg1)) as (set (reg1) (any_extend (expression))) (set (reg2) (reg1)) but instead (set (reg2) (any_extend (expression))) (set (reg1) (reg2)) ?).