From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 369523858401; Thu, 20 Apr 2023 20:40:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 369523858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682023215; bh=dxGM5nOD7lNW5AJCWAcV7Yp+LAvK8xmn+S8TjoBEAPs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lbmeiaXNDmy7JIcWLABpjVE957nQZd2Vktgj/g8AWYU68BVc+H0yOSXhzwsAE1+AG bPrFk1CN7uiVcAzeEuvMiSpXKRk9/mN6+/C9JEmm8697QQq9mHkvejQczL5w6Lw5qi KZqxF0ORcn1Gcd7Q8xammQtgI0qXIHQ6g9GewC6c= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/105753] [avr] ICE: in add_clobbers, at config/avr/avr-dimode.md:2705 Date: Thu, 20 Apr 2023 20:40:13 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: component Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105753 Georg-Johann Lay changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |rtl-optimization --- Comment #15 from Georg-Johann Lay --- The error is in the combine pass. Prior to combine, we have the followng insn for divmod (from -da init-regs dump): (insn 9 7 11 3 (parallel [ (set (reg:SI 50) (udiv:SI (reg/v:SI 47 [ n ]) (reg:SI 51))) (set (reg:SI 49) (umod:SI (reg/v:SI 47 [ n ]) (reg:SI 51))) (clobber (reg:SI 18 r18)) (clobber (reg:SI 22 r22)) (clobber (reg:HI 26 r26)) (clobber (reg:HI 30 r30)) ]) "bug.c":6:15 403 {udivmodsi4} (expr_list:REG_UNUSED (reg:HI 30 r30) (expr_list:REG_UNUSED (reg:HI 26 r26) (expr_list:REG_UNUSED (reg:SI 22 r22) (expr_list:REG_UNUSED (reg:SI 18 r18) (nil)))))) This basically encodes a transparent libgcc call to __udivmodsi4 (insn "*udivmodsi4_call"). The combine dump however reads: (insn 9 7 11 3 (set (reg:SI 49) (umod:SI (reg/v:SI 47 [ n ]) (reg:SI 51))) "bug.c":6:15 403 {udivmodsi4} (expr_list:REG_UNUSED (reg:HI 30 r30) (expr_list:REG_UNUSED (reg:HI 26 r26) (expr_list:REG_UNUSED (reg:SI 22 r22) (expr_list:REG_UNUSED (reg:SI 18 r18) (nil)))))) (insn 11 9 14 3 (set (reg/v:SI 45 [ n ]) (reg/v:SI 47 [ n ])) 119 {*movsi_split} (expr_list:REG_DEAD (reg/v:SI 47 [ n ]) (nil))) (insn 14 11 15 3 (set (reg/v:SI 47 [ n ]) (udiv:SI (reg/v:SI 47 [ n ]) (reg:SI 51))) "bug.c":7:7 119 {*movsi_split} (expr_list:REG_DEAD (reg:SI 50) (nil))) These udiv and umod insn do not exist and are unrecognizable. Combine shou= ld never have split the original udivmodsi4. I used the original test case from comment #0 with=20 $ avr-gcc bug.c -S -O1 -mmcu=3Datmega8 -da=20 where avr-gcc is from 2023-03-03 master (future v13). With -fdisable-rtl-combine no ICE occurs.=