From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF45F3858022; Wed, 29 Nov 2023 10:45:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF45F3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701254724; bh=g90VXYgneYg8SK+jmS+YzpiWmmgDPBZlN49HCsFsG1k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Nt07PrlCYxS89P+2Tt3BQNgAiXhkFE5iMjIhxfILGCJFEbjBNiQxmdkxWGRrMbQlm IHS8YgDPrcuTkoNSRcwz73i7aopp0qFvR116mBLBJh7qs1EgtnPdcY7Is0TpeAbs4i jfTVpto3xRiVN60sAN3MQXrTit+Neq5p2mYeysuI= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/112760] [14 Regression] wrong code with -O2 -fno-dce -fno-guess-branch-probability -m8bit-idiv -mavx --param=max-cse-insns=0 and __builtin_add_overflow_p() Date: Wed, 29 Nov 2023 10:45:23 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com 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: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: component cf_reconfirmed_on everconfirmed bug_status target_milestone 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=3D112760 Uro=C5=A1 Bizjak changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |rtl-optimization Last reconfirmed| |2023-11-29 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Target Milestone|--- |14.0 --- Comment #2 from Uro=C5=A1 Bizjak --- With the original testcase, ce1 pass is if-converting: 20: flags:CCZ=3Dcmp(r110:SI,r111:SI) REG_DEAD r111:SI REG_DEAD r110:SI 21: pc=3D{(flags:CCZ=3D=3D0)?L23:pc} REG_DEAD flags:CCZ 39: NOTE_INSN_BASIC_BLOCK 5 22: r103:HI=3D0x1 23: L23: with: IF-THEN-JOIN block found, pass 2, test 2, then 5, join 6 scanning new insn with uid =3D 45. scanning new insn with uid =3D 44. scanning new insn with uid =3D 46. if-conversion succeeded through noce_try_cmove Removing jump 21. deleting insn with uid =3D 21. deleting insn with uid =3D 22. to: 20: flags:CCZ=3Dcmp(r110:SI,r111:SI) REG_DEAD r111:SI REG_DEAD r110:SI 45: r118:HI=3D0x1 44: flags:CCZ=3Dcmp(r110:SI,r111:SI) 46: r103:HI=3D{(flags:CCZ=3D=3D0)?r103:HI:r118:HI} And things go downhill from here. Before postreload we have: 20: flags:CCZ=3Dcmp(ax:SI,dx:SI) REG_UNUSED flags:CCZ 44: flags:CCZ=3Dcmp(ax:SI,dx:SI) REG_DEAD dx:SI REG_DEAD ax:SI 62: ax:HI=3D0x1 REG_EQUIV 0x1 46: bx:HI=3D{(flags:CCZ=3D=3D0)?bx:HI:ax:HI} REG_DEAD flags:CCZ REG_DEAD ax:HI and in posteload pass (insn 44) is removed: 20: flags:CCZ=3Dcmp(ax:SI,dx:SI) REG_UNUSED flags:CCZ 62: ax:HI=3D0x1 REG_EQUIV 0x1 46: bx:HI=3D{(flags:CCZ=3D=3D0)?bx:HI:ax:HI} REG_DEAD flags:CCZ REG_DEAD ax:HI here comes pro_and_epilogue pass that detects "unused" (insn 20) and removes it: df_analyze called deleting insn with uid =3D 20. Confirmed as RTL optimization problem.=