diff options
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 7853d69..494b41e 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -88,6 +88,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-scalar-evolution.h" #include "cfgloop.h" #include "params.h" +#include "langhooks.h" /* The infinite cost. */ #define INFTY 10000000 @@ -1980,23 +1981,28 @@ add_candidate (struct ivopts_data *data, add_candidate_1 (data, base, step, important, IP_END, use, NULL_TREE); } +/* Add a standard "0 + 1 * iteration" iv candidate for a + type with SIZE bits. */ + +static void +add_standard_iv_candidates_for_size (struct ivopts_data *data, + unsigned int size) +{ + tree type = lang_hooks.types.type_for_size (size, true); + add_candidate (data, build_int_cst (type, 0), build_int_cst (type, 1), + true, NULL); +} + /* Adds standard iv candidates. */ static void add_standard_iv_candidates (struct ivopts_data *data) { - /* Add 0 + 1 * iteration candidate. */ - add_candidate (data, - build_int_cst (unsigned_intSI_type_node, 0), - build_int_cst (unsigned_intSI_type_node, 1), - true, NULL); + add_standard_iv_candidates_for_size (data, INT_TYPE_SIZE); - /* The same for a long type if it is still fast enough. */ - if (BITS_PER_WORD > 32) - add_candidate (data, - build_int_cst (unsigned_intDI_type_node, 0), - build_int_cst (unsigned_intDI_type_node, 1), - true, NULL); + /* The same for a double-integer type if it is still fast enough. */ + if (BITS_PER_WORD >= INT_TYPE_SIZE * 2) + add_standard_iv_candidates_for_size (data, INT_TYPE_SIZE * 2); } |