diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-27 16:53:09 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-27 16:53:09 +0000 |
commit | 38a664976f4416537b96beac9f9840f49c8724e0 (patch) | |
tree | e1b8b759d9b426b961abafcc38d68c6a098bae4d /gcc/tree-ssa-loop-manip.c | |
parent | c71f56cea05324f042650d0459b47dca70458469 (diff) | |
download | gcc-38a664976f4416537b96beac9f9840f49c8724e0.tar.gz |
Fix PR49471: canonicalize_loop_ivs should not generate unsigned types.
2011-07-27 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/49471
* tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned
iv only when the largest type is unsigned. Do not call
lang_hooks.types.type_for_size.
* testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail.
* testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176838 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-manip.c')
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 8176ed8d04c..0cec7872b81 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1200,18 +1200,36 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch) gimple stmt; edge exit = single_dom_exit (loop); gimple_seq stmts; + enum machine_mode mode; + bool unsigned_p = false; for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi)) { gimple phi = gsi_stmt (psi); tree res = PHI_RESULT (phi); + bool uns; - if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision) - precision = TYPE_PRECISION (TREE_TYPE (res)); + type = TREE_TYPE (res); + if (!is_gimple_reg (res) + || (!INTEGRAL_TYPE_P (type) + && !POINTER_TYPE_P (type)) + || TYPE_PRECISION (type) < precision) + continue; + + uns = POINTER_TYPE_P (type) | TYPE_UNSIGNED (type); + + if (TYPE_PRECISION (type) > precision) + unsigned_p = uns; + else + unsigned_p |= uns; + + precision = TYPE_PRECISION (type); } - type = lang_hooks.types.type_for_size (precision, 1); + mode = smallest_mode_for_size (precision, MODE_INT); + precision = GET_MODE_PRECISION (mode); + type = build_nonstandard_integer_type (precision, unsigned_p); if (original_precision != precision) { |