From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B9FD3858D35; Mon, 7 Mar 2022 09:39:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B9FD3858D35 From: "stefansf at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/104814] New: [10/11/12 Regression] ifcvt: Deleting live variable in IF-CASE-2 Date: Mon, 07 Mar 2022 09:39:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: stefansf at linux dot ibm.com 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone cf_gcctarget attachments.created Message-ID: 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: Mon, 07 Mar 2022 09:39:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104814 Bug ID: 104814 Summary: [10/11/12 Regression] ifcvt: Deleting live variable in IF-CASE-2 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: stefansf at linux dot ibm.com Target Milestone: --- Target: s390x-*-* Created attachment 52570 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52570&action=3Dedit dump ce2 short a =3D 0; static long b =3D 0; int c =3D 7; char d =3D 0; short *e =3D &a; long f =3D 0; unsigned long g (unsigned long h, long j) { return j =3D=3D 0 ? h : h / j; } int main (void) { long k =3D f; for (; c; --c) { for (int i =3D 0; i < 7; ++i) ; long m =3D g (f, --b); d =3D ((char)m | *e) <=3D 43165; } if (b !=3D -7) __builtin_abort (); return 0; } Variable b should be decremented in each iteration of the outer loop and th= us equal -7 at the end. After combine a load, decrement, and store insn exists: (insn 13 12 14 3 (set (reg:DI 62 [ b_lsm.16 ]) (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) (const_int 8 [0x8]))) [1 b+0 S8 A64])) 1469 {*movdi_64} (nil)) (jump_insn 40 39 46 6 (parallel [ (set (pc) (if_then_else (ne (reg:DI 62 [ b_lsm.16 ]) (const_int 1 [0x1])) (label_ref 38) (pc))) (set (reg:DI 62 [ b_lsm.16 ]) (plus:DI (reg:DI 62 [ b_lsm.16 ]) (const_int -1 [0xffffffffffffffff]))) (clobber (scratch:DI)) (clobber (reg:CC 33 %cc)) ]) "t.c":8:63 2164 {doloop_di} (expr_list:REG_UNUSED (reg:CC 33 %cc) (int_list:REG_BR_PROB 536870916 (nil))) -> 38) (insn 48 47 49 7 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) (const_int 8 [0x8]))) [1 b+0 S8 A64]) (reg:DI 62 [ b_lsm.16 ])) 1469 {*movdi_64} (expr_list:REG_DEAD (reg:DI 62 [ b_lsm.16 ]) (nil))) Pass ce2 deletes jump insn 40 including the decrement of variable b: IF-CASE-2 found, start 6, else 4 deleting insn with uid =3D 40. deleting block 4 Conversion succeeded on pass 1. Thus variable b equals 0 in the end.=