This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
>> >> 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. > Thanks for the review. How about: - if (!INTEGRAL_TYPE_P (TREE_TYPE (lhs)) - || TREE_CODE (rhs) != SSA_NAME - || TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE) + if (gimple_assign_cast_p (stmt) + && (!INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + || TREE_CODE (rhs) != SSA_NAME + || TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE)) Thanks, Kugan gcc/ChangeLog: 2015-07-16 Kugan Vivekanandarajah <kuganv@linaro.org> PR middle-end/66726 * tree-ssa-reassoc.c (optimize_range_tests): Handle tcc_compare stmt whose result is used in PHI. (maybe_optimize_range_tests): Likewise. (final_range_test_p): Lokweise.
Attachment:
p.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |