From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E2DF53857838; Wed, 23 Sep 2020 05:36:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2DF53857838 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600839398; bh=C1ed0I3wEcItFg5BrhxpyWaWB80NrMJmuRmRud4hP7A=; h=From:To:Subject:Date:From; b=U7I8n1BQcUMiQdIaUFT7nAQhm4zcQh8iEZSsff17TEJmI6vd5oGJ3IqPWN5oqhCRb tikfWwDHLeAqoDKqB67iq1yhI5hLfbQB+s+tUZdX904uu1CsDF79k8XTR3lV5WkFCg Ub3lTuHRCFXuIZrh7SpXYZVwFyTWmAWaoOMcDOkc= From: "rjiejie at me dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/97170] New: Wrong optimization in fwprop pass Date: Wed, 23 Sep 2020 05:36:38 +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: 8.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rjiejie at me dot 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 bug_severity priority component assigned_to reporter target_milestone 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: Wed, 23 Sep 2020 05:36:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97170 Bug ID: 97170 Summary: Wrong optimization in fwprop pass Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rjiejie at me dot com Target Milestone: --- insn seqs: s1: __builtin_set_float_convert_mode(0); r1 =3D __builtin_load(a1, a2); r2 =3D __builtin_float_convert(r1); __builtin_store(a3, r2); __builtin_set_float_convert_mode(0); s2: __builtin_set_float_convert_mode(1); r1 =3D __builtin_load(a1, a2); r2 =3D __builtin_float_convert(r1); __builtin_store(a3, r2); __builtin_set_float_convert_mode(0); the diference of s1 and s2 only is "__builtin_set_float_convert_mode" from beginning, the s1 mode is set 0, but s2 mode is set 1. from optimization 'fwprop', the s2 insns seqs is deleted=20 as dead code, is it gcc bug ? builtin patten of __builtin_set_float_convert_mode: (define_insn "target_fcvtmode" [(set (reg:SI FCVTMODE_REGNUM) (unspec_volatile:SI [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FCVTMODE))] "" "fcvtmode\t%1" ) builtin patten of __builtin_set_float_convert_mode: (define_insn "target_fcvt" [(set (match_operand:SI 0 "register_operand" "=3Dr") (unspec:SI [(match_operand:SF 1 "register_operand" "f")] UNSPEC_FCVT)) (use (reg:SI FCVTMODE_REGNUM))] "" "fcvt\t%0,%1" ) As far as i know, __builtin_set_float_convert_mode depend on 'FCVTMODE_REGN= UM' which is from __builtin_set_float_convert_mode, it's not dead code. or something wrong in my pattens ? Anyone could give me some hints ? Thanks=