From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix PR83158
Date: Tue, 28 Nov 2017 08:31:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.20.1711280911520.12252@zhemvz.fhfr.qr> (raw)
Recent changes caused VRP to create [-2147483646, +INF] from
merging ~[0, 0] and [-2147483646, +INF]. This causes i386 specific
folding of lznct to no longer trigger. The following extends the
existing special-casing of ~[0, 0] from pointer-like types to
pointer types and integer types > int (covering integral arguments).
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2017-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/83158
* tree-vrp.c (intersect_ranges): Prefer ~[0, 0] in a few more
cases.
Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c (revision 255173)
+++ gcc/tree-vrp.c (working copy)
@@ -6021,11 +6021,14 @@ intersect_ranges (enum value_range_type
&& vrp_val_is_max (vr1max))
;
/* Choose the anti-range if it is ~[0,0], that range is special
- enough to special case when vr1's range is relatively wide. */
+ enough to special case when vr1's range is relatively wide.
+ At least for types bigger than int - this covers pointers
+ and arguments to functions like ctz. */
else if (*vr0min == *vr0max
&& integer_zerop (*vr0min)
- && (TYPE_PRECISION (TREE_TYPE (*vr0min))
- == TYPE_PRECISION (ptr_type_node))
+ && ((TYPE_PRECISION (TREE_TYPE (*vr0min))
+ >= TYPE_PRECISION (integer_type_node))
+ || POINTER_TYPE_P (TREE_TYPE (*vr0min)))
&& TREE_CODE (vr1max) == INTEGER_CST
&& TREE_CODE (vr1min) == INTEGER_CST
&& (wi::clz (wi::to_wide (vr1max) - wi::to_wide (vr1min))
reply other threads:[~2017-11-28 8:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=alpine.LSU.2.20.1711280911520.12252@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@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).