On 07/15/2015 01:09 AM, Kugan wrote:
2015-07-15 Kugan Vivekanandarajah<kug...@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