This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR66726] Factor conversion out of COND_EXPR
- From: Jeff Law <law at redhat dot com>
- To: Kugan <kugan dot vivekanandarajah at linaro dot org>, Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 15 Jul 2015 12:45:33 -0600
- Subject: Re: [PR66726] Factor conversion out of COND_EXPR
- Authentication-results: sourceware.org; auth=none
- References: <55974BF2 dot 3060603 at linaro dot org> <20150704085143 dot GA14895 at nbbrfq dot cc dot univie dot ac dot at> <5597D24B dot 8010900 at linaro dot org> <559AF515 dot 6010700 at redhat dot com> <559BCB15 dot 9010209 at linaro dot org> <559BE505 dot 5070802 at redhat dot com> <559EFEE5 dot 6030006 at linaro dot org> <55A02DBF dot 6030608 at redhat dot com> <55A24E7D dot 4080609 at linaro dot org> <55A6073D dot 1020800 at linaro dot org>
On 07/15/2015 01:09 AM, Kugan wrote:
2015-07-15 Kugan Vivekanandarajah<kuganv@linaro.org>
PR middle-end/66726
* tree-ssa-reassoc.c (optimize_range_tests): Handle sinking the cast
after PHI.
(final_range_test_p): Detect sinking the cast after PHI.
(maybe_optimize_range_tests): Handle sinking the cast after PHI.
Can we tweak
p.txt
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 932c83a..3058eb5 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
return false;
bb = gimple_bb (stmt);
if (!single_succ_p (bb))
@@ -2729,9 +2743,8 @@ final_range_test_p (gimple stmt)
lhs = gimple_assign_lhs (stmt);
rhs = gimple_assign_rhs1 (stmt);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (lhs))
- || TREE_CODE (rhs) != SSA_NAME
- || TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE)
+ if (TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
+ && TREE_CODE (TREE_TYPE (lhs)) != BOOLEAN_TYPE)
return false;
So you're ensuring that one of the two is a boolean... Note that
previously we ensured that the rhs was a boolean and the lhs was an
integral type (which I believe is true for booleans).
Thus if we had
bool x;
int y;
x = (bool) y;
The old code would have rejected that case. But I think it gets through
now, right?
I think once that issue is addressed, this will be good for the trunk.
jeff