From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7091 invoked by alias); 11 Apr 2011 17:11:59 -0000 Received: (qmail 7083 invoked by uid 22791); 11 Apr 2011 17:11:58 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Apr 2011 17:11:54 +0000 From: "vmakarov at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/48496] [4.7 Regression] 'asm' operand requires impossible reload in libffi/src/ia64/ffi.c X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: build, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: vmakarov at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 11 Apr 2011 17:11:00 -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 X-SW-Source: 2011-04/txt/msg01104.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496 --- Comment #4 from Vladimir Makarov 2011-04-11 17:11:37 UTC --- The new big IRA patch just triggered a latent reload bug. The code in question is in function reload_as_needed /* If this was an ASM, make sure that all the reload insns we have generated are valid. If not, give an error and delete them. */ if (asm_noperands (PATTERN (insn)) >= 0) for (p = NEXT_INSN (prev); p != next; p = NEXT_INSN (p)) if (p != insn && INSN_P (p) && GET_CODE (PATTERN (p)) != USE && (recog_memoized (p) < 0 || (extract_insn (p), ! constrain_operands (1)))) { error_for_asm (insn, "% operand requires " "impossible reload"); delete_insn (p); } } A previous insn P has a spilled pseudo and that results in the error generation because spilled pseudos are changed by memory later. I guess the above code is wrong if a previous insn has a spilled pseudo. The bug did not occur before the big IRA patch because the pseudo in question happened not to be spilled. I should mention that it is more profitable to spill the pseudo and the new IRA makes the right decision (which results in live range shrinkage and decreasing register pressure). I could make a patch (preventing the error generation if there are spilled pseudos in insn P) but I think that reload maintainers would do that different (e.g. moving the check after changing spilled pseudos by memory) or make a better patch.