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 13:27:04 +0000 [thread overview] Message-ID: <bug-24021-4-lDrcTs4Xgk@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 #25 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- Adding some notes here as I work through this PR... Even with floating aware VRP, we won't be able to do much because SCEV (which ranger and VRP use) does not work with non-integers. At EVRP time we see: double BG_SplineLength () { double i; double lastPoint; <bb 2> : goto <bb 6>; [INV] <bb 3> : if (i_3 == 0.0) goto <bb 5>; [INV] else goto <bb 4>; [INV] <bb 4> : <bb 5> : # lastPoint_1 = PHI <i_3(3), 2.0e+0(4)> i_10 = i_3 + 1.00000001490116119384765625e-1; <bb 6> : # lastPoint_2 = PHI <lastPoint_5(D)(2), lastPoint_1(5)> # i_3 = PHI <1.00000000000000002081668171172168513294309377670288085938e-2(2), i_10(5)> if (i_3 <= 1.0e+0) goto <bb 3>; [INV] else goto <bb 7>; [INV] <bb 7> : return lastPoint_2; } On the 6->3 edge we know that i_3 is [-INF, 1.0], so even adding a range-op entry for the PLUS_EXPR, we'd know that i_3 is [-INF, 1.1], which is not enough to fold the i_3 == 0.0 conditional. If you convert this testcase to integer and turn off SCEV (and unrolling and FRE, etc), you'll notice that VRP doesn't do much here (in either legacy nor ranger mode). We would need SCEV to give us [1.0, 1.1] in order to fold the i_3 == 0.0 conditional. For that matter, if I hack SCEV to give us the expected end points, I can get evrp to fold the conditional. I think once VRP is FP aware, we can close this PR because this particular testcase is SCEV specific. So for this particular testcase, perhaps we could open a SCEV+FP PR? As an aside, the second conditional will not be folded by VRP (legacy or ranger), even with SCEV, even if you convert the above testcase to integer...it's either gotten later by unrolling+FRE for FP, or cddce for integers. What I'm trying to say is that even with FP VRP, which we'll have shortly, the first conditional won't be folded because SCEV doesn't do floats, and the second one won't be, because it's not VRP's job.
next prev parent reply other threads:[~2022-08-01 13:27 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 [this message] 2022-08-01 14:30 ` aldyh at gcc dot gnu.org 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-lDrcTs4Xgk@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).