From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 04A503858C36 for ; Thu, 7 Mar 2024 17:38:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04A503858C36 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 04A503858C36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.228.1.57 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709833083; cv=none; b=Kb2DQNICvAEfbybRxpywEEwZguFynE7+KRxDAk3omlAhIWvaGa0Zx5j5kU0SdCdGPTFLOAoq4sOBVW8y9De/DqkEGtixNOujnZ/F3tiLFfXYMpfVby6ZM0Sh00OjXlEsmrqqI6eD+OfJn/5PI3L6Sb/4oi8yHpL6zWSGSoIQ0Fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709833083; c=relaxed/simple; bh=gxSFbbwzJXB2q9XcmY8SsKoaN7OOHDNlY2W+dh8m12I=; h=Date:From:To:Subject:Message-ID:Mime-Version; b=n4y+T8mg8vx55iK5i7ljf6hBZ9lURGEhlKGgLsgZnUVxdfsUrOz7eD+EwAm8L6oVrNRlHhZxYQNW0fBJzIQEhNc/6bZHC13wXkATox1dElcX8/8H0QPAc1JKt6pvH+mmSB0Pd2he3vUW92xaLDo3YugHK8pHz2Uk4lozgmls8J8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 427Hb0Me005831; Thu, 7 Mar 2024 11:37:01 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 427Hb0Vq005830; Thu, 7 Mar 2024 11:37:00 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 7 Mar 2024 11:36:59 -0600 From: Segher Boessenkool To: Richard Biener Cc: Uros Bizjak , "gcc-patches@gcc.gnu.org" , Jeff Law Subject: Re: [PATCH v2] combine: Fix ICE in try_combine on pr112494.c [PR112560] Message-ID: <20240307173659.GH19790@gate.crashing.org> References: <2737spr1-459p-3oon-n852-qn034s55p66r@fhfr.qr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2737spr1-459p-3oon-n852-qn034s55p66r@fhfr.qr> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Mar 07, 2024 at 10:55:12AM +0100, Richard Biener wrote: > On Thu, 7 Mar 2024, Uros Bizjak wrote: > > This is > > > > 3236 /* Just replace the CC reg with a new mode. */ > > 3237 SUBST (XEXP (*cc_use_loc, 0), newpat_dest); > > 3238 undobuf.other_insn = cc_use_insn; > > > > in combine.cc, where *cc_use_loc is > > > > (unspec:DI [ > > (reg:CC 17 flags) > > ] UNSPEC_PUSHFL) > > > > combine assumes CC must be used inside of a comparison and uses XEXP (..., 0) No. It has established *this is the case* some time earlier. Lines\ 3155 and on, what begins with /* Many machines have insns that can both perform an arithmetic operation and set the condition code. > > OK for trunk? > > Since you CCed me - looking at the code I wonder why we fatally fail. I did not get this email btw. Some blip in email (on the sender's side) I guess? > The following might also fix the issue and preserve more of the > rest of the flow of the function. > --- a/gcc/combine.cc > +++ b/gcc/combine.cc > @@ -3182,7 +3182,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn > *i1, rtx_insn *i0, > > if (undobuf.other_insn == 0 > && (cc_use_loc = find_single_use (SET_DEST (newpat), i3, > - &cc_use_insn))) > + &cc_use_insn)) > + && COMPARISON_P (*cc_use_loc)) Line 3167 already is && GET_CODE (SET_SRC (PATTERN (i3))) == COMPARE so what in your backend is unusual? Segher