diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-03 09:41:55 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-03 09:41:55 +0000 |
commit | 493a1c5266c6311c7deca60c3a6cc50df3fbcbe8 (patch) | |
tree | 2dcc575309c723e8fc1f116d6b9266265cda02b3 | |
parent | c5e55d1c4264e66a0a34bd7410130c865d4bfc84 (diff) | |
download | gcc-493a1c5266c6311c7deca60c3a6cc50df3fbcbe8.tar.gz |
PR tree-optimization/81655
PR tree-optimization/81588
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Handle also
the case when ranges[i].low and high are 1 for unsigned type with
precision 1.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250849 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 19 |
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9b923a22fa..466afb908b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2017-08-03 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/81655 + PR tree-optimization/81588 + * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Handle also + the case when ranges[i].low and high are 1 for unsigned type with + precision 1. + PR middle-end/81052 * omp-low.c (diagnose_sb_0): Handle flag_openmp_simd like flag_openmp. (pass_diagnose_omp_blocks::gate): Enable also for flag_openmp_simd. diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index b4fe488e797..6ecba809199 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2918,11 +2918,22 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, for (i = 0; i < length; i++) { + bool in_p = ranges[i].in_p; if (ranges[i].low == NULL_TREE - || ranges[i].high == NULL_TREE - || !integer_zerop (ranges[i].low) - || !integer_zerop (ranges[i].high)) + || ranges[i].high == NULL_TREE) continue; + if (!integer_zerop (ranges[i].low) + || !integer_zerop (ranges[i].high)) + { + if (ranges[i].exp + && TYPE_PRECISION (TREE_TYPE (ranges[i].exp)) == 1 + && TYPE_UNSIGNED (TREE_TYPE (ranges[i].exp)) + && integer_onep (ranges[i].low) + && integer_onep (ranges[i].high)) + in_p = !in_p; + else + continue; + } gimple *stmt; tree_code ccode; @@ -2964,7 +2975,7 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, default: continue; } - if (ranges[i].in_p) + if (in_p) ccode = invert_tree_comparison (ccode, false); switch (ccode) { |