This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][PR tree-optimization/69270] Exploit VRP information in DOM
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 14 Jan 2016 19:49:23 -0700
- Subject: Re: [PATCH][PR tree-optimization/69270] Exploit VRP information in DOM
- Authentication-results: sourceware.org; auth=none
- References: <5697508C dot 6050006 at redhat dot com> <CAFiYyc3m6WS0KVRzQM9Xh8Gf=cU=zUTwuFGcopkWJxMNE=pNeQ at mail dot gmail dot com> <5697E8AB dot 4060504 at redhat dot com>
On 01/14/2016 11:27 AM, Jeff Law wrote:
Apart from what Jakub said we have constant_boolean_node for this,
true_val = constant_boolean_node (true, TREE_TYPE (op0));
Will update. Thanks.
Here's the patch which uses constant_boolean_node and verifies the type
is unsigned when it has a single bit of precision case.
The other part of Jakub's suggestion regresses code generation in the
final assembly -- we're getting some constant initializations when
they're not needed. I'm highly confident we just need to mirror a few
bits into the uncprop pass, which I'll be looking at directly.
Bootstrapped and regression tested on x86_64. Installed on the trunk.
Jeff
commit d1bdc38e96ec5ae607a472968134e5d8b0ac4456
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Jan 15 02:45:44 2016 +0000
PR tree-optimization/69270
* tree-ssa-dom.c (ssa_name_has_boolean_range): If the type has a
single bit of precision, verify it's also unsigned.
(record_edge_info): Use constant_boolean_node rather than fold_convert
to convert boolean_true/boolean_false to the right type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232399 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 790662511..6f9c6a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2016-01-14 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/69270
+ * tree-ssa-dom.c (ssa_name_has_boolean_range): If the type has a
+ single bit of precision, verify it's also unsigned.
+ (record_edge_info): Use constant_boolean_node rather than fold_convert
+ to convert boolean_true/boolean_false to the right type.
+
2016-01-14 Richard Henderson <rth@redhat.com>
PR rtl-opt/69014
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index da4faca..f2257b3 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -319,8 +319,8 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted)
/* Return TRUE is OP, an SSA_NAME has a range of values [0..1], false
otherwise.
- This can be because it is a boolean type, any type with
- a single bit of precision, or has known range of [0..1]
+ This can be because it is a boolean type, any unsigned integral
+ type with a single bit of precision, or has known range of [0..1]
via VRP analysis. */
static bool
@@ -332,6 +332,7 @@ ssa_name_has_boolean_range (tree op)
/* An integral type with a single bit of precision. */
if (INTEGRAL_TYPE_P (TREE_TYPE (op))
+ && TYPE_UNSIGNED (TREE_TYPE (op))
&& TYPE_PRECISION (TREE_TYPE (op)) == 1)
return true;
@@ -425,10 +426,9 @@ record_edge_info (basic_block bb)
&& ssa_name_has_boolean_range (op0)
&& is_gimple_min_invariant (op1))
{
- tree true_val = fold_convert (TREE_TYPE (op0),
- boolean_true_node);
- tree false_val = fold_convert (TREE_TYPE (op0),
- boolean_false_node);
+ tree true_val = constant_boolean_node (true, TREE_TYPE (op0));
+ tree false_val = constant_boolean_node (false, TREE_TYPE (op0));
+
if (code == EQ_EXPR)
{
edge_info = allocate_edge_info (true_edge);