Commit d482f417 by Zdenek Dvorak Committed by Zdenek Dvorak

re PR target/20625 (ivopts produces code that generates "unaligned access exception")

	PR target/20625
	* tree-ssa-loop-ivopts.c (generic_type_for): New function.
	(add_candidate_1): Use generic_type_for instead of unsigned_type_for.

From-SVN: r97674
parent c33e657d
2005-04-06 Zdenek Dvorak <dvorakz@suse.cz> 2005-04-06 Zdenek Dvorak <dvorakz@suse.cz>
PR target/20625
* tree-ssa-loop-ivopts.c (generic_type_for): New function.
(add_candidate_1): Use generic_type_for instead of unsigned_type_for.
2005-04-06 Zdenek Dvorak <dvorakz@suse.cz>
* tree-flow.h (number_of_iterations_cond): Declaration removed. * tree-flow.h (number_of_iterations_cond): Declaration removed.
* tree-ssa-loop-niter.c (number_of_iterations_cond): Made static. * tree-ssa-loop-niter.c (number_of_iterations_cond): Made static.
(number_of_iterations_special): New function. (number_of_iterations_special): New function.
......
...@@ -1841,6 +1841,22 @@ strip_offset (tree expr, bool inside_addr, unsigned HOST_WIDE_INT *offset) ...@@ -1841,6 +1841,22 @@ strip_offset (tree expr, bool inside_addr, unsigned HOST_WIDE_INT *offset)
return fold_convert (orig_type, expr); return fold_convert (orig_type, expr);
} }
/* Returns variant of TYPE that can be used as base for different uses.
For integer types, we return unsigned variant of the type, which
avoids problems with overflows. For pointer types, we return void *. */
static tree
generic_type_for (tree type)
{
if (POINTER_TYPE_P (type))
return ptr_type_node;
if (TYPE_UNSIGNED (type))
return type;
return unsigned_type_for (type);
}
/* Adds a candidate BASE + STEP * i. Important field is set to IMPORTANT and /* Adds a candidate BASE + STEP * i. Important field is set to IMPORTANT and
position to POS. If USE is not NULL, the candidate is set as related to position to POS. If USE is not NULL, the candidate is set as related to
it. If both BASE and STEP are NULL, we add a pseudocandidate for the it. If both BASE and STEP are NULL, we add a pseudocandidate for the
...@@ -1853,14 +1869,14 @@ add_candidate_1 (struct ivopts_data *data, ...@@ -1853,14 +1869,14 @@ add_candidate_1 (struct ivopts_data *data,
{ {
unsigned i; unsigned i;
struct iv_cand *cand = NULL; struct iv_cand *cand = NULL;
tree type; tree type, orig_type;
if (base) if (base)
{ {
type = TREE_TYPE (base); orig_type = TREE_TYPE (base);
if (!TYPE_UNSIGNED (type)) type = generic_type_for (orig_type);
if (type != orig_type)
{ {
type = unsigned_type_for (type);
base = fold_convert (type, base); base = fold_convert (type, base);
if (step) if (step)
step = fold_convert (type, step); step = fold_convert (type, step);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment