public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/24021] VRP does not work with floating points
Date: Mon, 01 Aug 2022 14:30:45 +0000 [thread overview]
Message-ID: <bug-24021-4-p7FgOITJ5M@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-24021-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24021
--- Comment #26 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #19)
> We can use the original testcase as the litmus test for basic support if we
> compile it with
>
> -O2 -fno-tree-fre -fno-tree-dominator-opts
>
> The unroller will unroll the loop and the VRP2 pass will be presented with:
>
> <bb 2> [local count: 97603129]:
> i_1 = 1.1000000149011611438876201418679556809365749359130859375e-1;
> i_17 = i_1 + 1.00000001490116119384765625e-1;
> i_22 = i_17 + 1.00000001490116119384765625e-1;
> i_27 = i_22 + 1.00000001490116119384765625e-1;
> i_32 = i_27 + 1.00000001490116119384765625e-1;
> i_37 = i_32 + 1.00000001490116119384765625e-1;
> i_42 = i_37 + 1.00000001490116119384765625e-1;
> i_47 = i_42 + 1.00000001490116119384765625e-1;
> i_52 = i_47 + 1.00000001490116119384765625e-1;
> if (i_52 == 0.0)
> goto <bb 4>; [50.00%]
> else
> goto <bb 3>; [50.00%]
>
> <bb 3> [local count: 48801565]:
>
> <bb 4> [local count: 97603129]:
> # lastPoint_12 = PHI <i_52(2), 2.0e+0(3)>
> return lastPoint_12;
>
> Which is we can track floating point ranges in VRP and simplification,
> recognize that i_52 != 0.0 and VRP2 should be able to resolve this to
>
> return 2.0e+0;
Errr, just saw this. I if we let the unroller do it's thing, we can catch this
at VRP2, and continue using this testcase.
And sure enough, my current work catches this:
Folding statement: i_5 =
1.1000000149011611438876201418679556809365749359130859375e-1;
Queued stmt for removal. Folds to:
1.1000000149011611438876201418679556809365749359130859375e-1
Folding statement: i_17 = i_5 + 1.00000001490116119384765625e-1;
Queued stmt for removal. Folds to:
2.100000029802322476513154470012523233890533447265625e-1
...
...
...
Folding statement: if (i_52 == 0.0)
gimple_simplified to if (0 != 0)
gimple_simplified to if (0 != 0)
Folded into: if (0 != 0)
next prev parent reply other threads:[~2022-08-01 14:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-24021-4@http.gcc.gnu.org/bugzilla/>
2021-08-25 20:29 ` amacleod at redhat dot com
2022-02-07 16:07 ` aldyh at gcc dot gnu.org
2022-02-09 16:35 ` aldyh at gcc dot gnu.org
2022-02-09 17:04 ` law at gcc dot gnu.org
2022-02-09 17:27 ` aldyh at gcc dot gnu.org
2022-02-09 17:29 ` vincent-gcc at vinc17 dot net
2022-02-09 17:31 ` vincent-gcc at vinc17 dot net
2022-02-09 18:30 ` jakub at gcc dot gnu.org
2022-02-09 18:31 ` amacleod at redhat dot com
2022-02-09 18:35 ` amacleod at redhat dot com
2022-02-09 19:05 ` vincent-gcc at vinc17 dot net
2022-02-10 9:33 ` rguenth at gcc dot gnu.org
2022-02-10 12:02 ` jakub at gcc dot gnu.org
2022-02-10 12:21 ` rguenther at suse dot de
2022-02-10 14:17 ` vincent-gcc at vinc17 dot net
2022-04-05 19:34 ` amacleod at redhat dot com
2022-04-06 9:34 ` aldyh at gcc dot gnu.org
2022-04-06 9:46 ` jakub at gcc dot gnu.org
2022-04-06 9:57 ` aldyh at gcc dot gnu.org
2022-04-06 10:30 ` aldyh at gcc dot gnu.org
2022-04-06 10:47 ` jakub at gcc dot gnu.org
2022-08-01 13:27 ` aldyh at gcc dot gnu.org
2022-08-01 14:30 ` aldyh at gcc dot gnu.org [this message]
2022-11-08 15:54 ` cvs-commit at gcc dot gnu.org
2022-11-08 15:57 ` aldyh at gcc dot gnu.org
2022-11-28 22:15 ` pinskia at gcc dot gnu.org
[not found] <bug-24021-6528@http.gcc.gnu.org/bugzilla/>
2005-10-23 23:43 ` pinskia at gcc dot gnu dot 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-24021-4-p7FgOITJ5M@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: link
Be 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).