public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107569] [13 Regression] Failure to optimize std::isfinite since r13-3596 Date: Wed, 22 Mar 2023 15:26:51 +0000 [thread overview] Message-ID: <bug-107569-4-McfKUiZzT0@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107569-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107569 --- Comment #45 from Jakub Jelinek <jakub at gcc dot gnu.org> --- For the #c0 foo function, one simple fix would be something like --- gcc/passes.def.jj 2023-01-02 09:32:39.539037434 +0100 +++ gcc/passes.def 2023-03-22 16:12:57.387652639 +0100 @@ -85,6 +85,7 @@ along with GCC; see the file COPYING3. NEXT_PASS (pass_forwprop); NEXT_PASS (pass_early_thread_jumps, /*first=*/true); NEXT_PASS (pass_sra_early); + NEXT_PASS (pass_dce); /* pass_build_ealias is a dummy pass that ensures that we execute TODO_rebuild_alias at this point. */ NEXT_PASS (pass_build_ealias); The problem there is that ccp1 and forwprop1 passes result in some dead statements: _6 = ABS_EXPR <x_3(D)>; _4 = _6 u> 1.79769313486231570814527423731704356798070567525844996599e+308; _8 = ~_4; _12 = _8; _1 = _12; retval.0_5 = ~_1; if (retval.0_5 != 0) by ccp1 into: _6 = ABS_EXPR <x_3(D)>; _4 = _6 u> 1.79769313486231570814527423731704356798070567525844996599e+308; _8 = ~_4; if (_4 != 0) and forwprop1: _6 = ABS_EXPR <x_3(D)>; _4 = _6 u> 1.79769313486231570814527423731704356798070567525844996599e+308; _8 = ~_4; if (_6 u> 1.79769313486231570814527423731704356798070567525844996599e+308) So, now both _8 and _4 setters are dead. Then comes fre1 and happily uses them again, which results in undesirable _6 = ABS_EXPR <x_3(D)>; _4 = _6 u> 1.79769313486231570814527423731704356798070567525844996599e+308; _8 = ~_4; if (_6 u> 1.79769313486231570814527423731704356798070567525844996599e+308) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : __builtin_unreachable (); <bb 4> : return _8; With the extra dce, we get _6 = ABS_EXPR <x_3(D)>; if (_6 u> 1.79769313486231570814527423731704356798070567525844996599e+308) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : __builtin_unreachable (); <bb 4> : _9 = ABS_EXPR <x_3(D)>; _10 = _9 u> 1.79769313486231570814527423731704356798070567525844996599e+308; _11 = ~_10; return _11; before fre1 and optimize that into: _6 = ABS_EXPR <x_3(D)>; if (_6 u> 1.79769313486231570814527423731704356798070567525844996599e+308) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : __builtin_unreachable (); <bb 4> : return 1;
next prev parent reply other threads:[~2023-03-22 15:26 UTC|newest] Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-08 12:09 [Bug tree-optimization/107569] New: " jakub at gcc dot gnu.org 2022-11-08 12:09 ` [Bug tree-optimization/107569] " jakub at gcc dot gnu.org 2022-11-08 12:59 ` pilarlatiesa at gmail dot com 2022-11-08 13:30 ` rguenth at gcc dot gnu.org 2022-11-08 13:34 ` jakub at gcc dot gnu.org 2022-11-08 14:46 ` amacleod at redhat dot com 2022-11-08 14:53 ` jakub at gcc dot gnu.org 2022-11-08 15:14 ` amacleod at redhat dot com 2022-11-08 15:34 ` jakub at gcc dot gnu.org 2022-11-08 15:53 ` amacleod at redhat dot com 2022-11-08 15:55 ` jakub at gcc dot gnu.org 2022-11-08 16:00 ` jakub at gcc dot gnu.org 2022-11-08 17:25 ` jakub at gcc dot gnu.org 2022-11-09 14:20 ` aldyh at gcc dot gnu.org 2022-11-09 14:27 ` aldyh at gcc dot gnu.org 2022-11-09 14:30 ` aldyh at gcc dot gnu.org 2022-11-09 15:01 ` pilarlatiesa at gmail dot com 2022-11-09 15:10 ` jakub at gcc dot gnu.org 2022-11-09 15:38 ` jakub at gcc dot gnu.org 2022-11-09 17:21 ` cvs-commit at gcc dot gnu.org 2022-11-09 18:21 ` jakub at gcc dot gnu.org 2022-11-10 9:32 ` aldyh at gcc dot gnu.org 2022-11-10 9:36 ` jakub at gcc dot gnu.org 2022-11-10 10:22 ` jakub at gcc dot gnu.org 2022-11-10 10:29 ` jakub at gcc dot gnu.org 2022-11-10 10:40 ` jakub at gcc dot gnu.org 2022-11-10 11:34 ` aldyh at gcc dot gnu.org 2022-11-10 11:34 ` aldyh at gcc dot gnu.org 2022-11-10 12:22 ` jakub at gcc dot gnu.org 2022-11-10 12:47 ` aldyh at gcc dot gnu.org 2022-11-10 12:54 ` jakub at gcc dot gnu.org 2022-11-10 13:19 ` aldyh at gcc dot gnu.org 2022-11-10 13:35 ` aldyh at gcc dot gnu.org 2022-11-10 16:12 ` jakub at gcc dot gnu.org 2022-11-10 17:50 ` aldyh at gcc dot gnu.org 2022-11-10 19:14 ` aldyh at gcc dot gnu.org 2022-11-10 19:29 ` jakub at gcc dot gnu.org 2022-11-11 7:15 ` aldyh at gcc dot gnu.org 2022-11-12 8:42 ` cvs-commit at gcc dot gnu.org 2022-11-12 8:42 ` cvs-commit at gcc dot gnu.org 2022-11-12 8:43 ` cvs-commit at gcc dot gnu.org 2022-11-30 1:43 ` romain.geissler at amadeus dot com 2022-12-08 16:24 ` jakub at gcc dot gnu.org 2022-12-08 16:32 ` jakub at gcc dot gnu.org 2022-12-08 16:37 ` jakub at gcc dot gnu.org 2022-12-09 15:34 ` amacleod at redhat dot com 2023-02-27 10:07 ` rguenth at gcc dot gnu.org 2023-03-22 15:26 ` jakub at gcc dot gnu.org [this message] 2023-03-22 16:07 ` jakub at gcc dot gnu.org 2023-03-23 8:38 ` jakub at gcc dot gnu.org 2023-03-23 13:47 ` rguenth at gcc dot gnu.org 2023-03-23 14:30 ` jakub at gcc dot gnu.org 2023-03-23 16:22 ` cvs-commit at gcc dot gnu.org 2023-03-23 16:22 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107569-4-McfKUiZzT0@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).