From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B4703858D39; Fri, 26 Nov 2021 22:06:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B4703858D39 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/103439] genemit emits dead code Date: Fri, 26 Nov 2021 22:06:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2021 22:06:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103439 --- Comment #5 from Andrew Pinski --- (In reply to Richard Biener from comment #4) > so quite hard if not impossible to "fix" in genemit The most complex one I saw in action was mod3 in aarch64.md: (define_expand "mod3" [(match_operand:GPI 0 "register_operand") (match_operand:GPI 1 "register_operand") (match_operand:GPI 2 "const_int_operand")] Where the pattern in the expand is not going to be used at all (obviously) = but has a conditional FAIL and then an unconditional DONE. if (val <=3D 0 || exact_log2 (val) <=3D 0 || !aarch64_bitmask_imm (val - 1, mode)) FAIL; .... rtx masked_neg =3D gen_reg_rtx (mode); emit_insn (gen_and3 (masked_neg, neg_op, mask)); emit_insn (gen_csneg3_insn (operands[0], cond, masked_neg, masked_pos)); DONE; And even splits will have issues too. See "*compare_condjump" in aarch64 where the pattern in the split will not be used but then there is an unconditional DONE: emit_jump_insn (gen_condjump (cmp_rtx, cc_reg, operands[2])); DONE; I think we should just close this as won't fix and add -Wno-unreachable-code while compiling the generated C file.=