From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix PR65774
Date: Thu, 16 Apr 2015 12:08:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1504161407340.6786@zhemvz.fhfr.qr> (raw)
The following avoids invoking bit-tracking on complex types which
have zero TYPE_PRECISION where wi::sext () invokes undefined behavior.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2015-04-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/65774
* tree-ssa-ccp.c (evaluate_stmt): Constrain types we invoke
bit-value tracking on.
Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c (revision 222140)
+++ gcc/tree-ssa-ccp.c (working copy)
@@ -1764,35 +1773,28 @@ evaluate_stmt (gimple stmt)
{
enum tree_code subcode = gimple_assign_rhs_code (stmt);
tree rhs1 = gimple_assign_rhs1 (stmt);
- switch (get_gimple_rhs_class (subcode))
- {
- case GIMPLE_SINGLE_RHS:
- if (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
- || POINTER_TYPE_P (TREE_TYPE (rhs1)))
- val = get_value_for_expr (rhs1, true);
- break;
-
- case GIMPLE_UNARY_RHS:
- if ((INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
- || POINTER_TYPE_P (TREE_TYPE (rhs1)))
- && (INTEGRAL_TYPE_P (gimple_expr_type (stmt))
- || POINTER_TYPE_P (gimple_expr_type (stmt))))
- val = bit_value_unop (subcode, gimple_expr_type (stmt), rhs1);
- break;
-
- case GIMPLE_BINARY_RHS:
- if (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
- || POINTER_TYPE_P (TREE_TYPE (rhs1)))
- {
- tree lhs = gimple_assign_lhs (stmt);
- tree rhs2 = gimple_assign_rhs2 (stmt);
- val = bit_value_binop (subcode,
- TREE_TYPE (lhs), rhs1, rhs2);
- }
- break;
+ tree lhs = gimple_assign_lhs (stmt);
+ if ((INTEGRAL_TYPE_P (TREE_TYPE (lhs))
+ || POINTER_TYPE_P (TREE_TYPE (lhs)))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
+ || POINTER_TYPE_P (TREE_TYPE (rhs1))))
+ switch (get_gimple_rhs_class (subcode))
+ {
+ case GIMPLE_SINGLE_RHS:
+ val = get_value_for_expr (rhs1, true);
+ break;
+
+ case GIMPLE_UNARY_RHS:
+ val = bit_value_unop (subcode, TREE_TYPE (lhs), rhs1);
+ break;
+
+ case GIMPLE_BINARY_RHS:
+ val = bit_value_binop (subcode, TREE_TYPE (lhs), rhs1,
+ gimple_assign_rhs2 (stmt));
+ break;
- default:;
- }
+ default:;
+ }
}
else if (code == GIMPLE_COND)
{
reply other threads:[~2015-04-16 12:08 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.11.1504161407340.6786@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).