GCC with patches for Dreamcast
修订版 | 5fb76d406e75acc7223df06b66b95e70705e1185 (tree) |
---|---|
时间 | 2021-03-17 20:17:51 |
作者 | Richard Biener <rguenther@suse...> |
Commiter | Richard Biener |
tree-optimization/93964 - adjust ISL code generation for pointer params
Pointers eventually need intermediate conversions in code generation.
Allowing them is much easier than fending them off since niter
and scev expansion easily drag those in.
2020-02-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/93964
* graphite-isl-ast-to-gimple.c
(gcc_expression_from_isl_ast_expr_id): Add intermediate
conversion for pointer to integer converts.
* graphite-scop-detection.c (assign_parameter_index_in_region):
Relax assert.
* gcc.dg/graphite/pr93964.c: New testcase.
(cherry picked from commit bb0ec9cffb1d0a3326d8c4ed197717fc08eeec37)
@@ -266,6 +266,9 @@ gcc_expression_from_isl_ast_expr_id (tree type, | ||
266 | 266 | tree t = res->second; |
267 | 267 | if (useless_type_conversion_p (type, TREE_TYPE (t))) |
268 | 268 | return t; |
269 | + if (POINTER_TYPE_P (TREE_TYPE (t)) | |
270 | + && !POINTER_TYPE_P (type) && !ptrofftype_p (type)) | |
271 | + t = fold_convert (sizetype, t); | |
269 | 272 | return fold_convert (type, t); |
270 | 273 | } |
271 | 274 |
@@ -1100,7 +1100,6 @@ static void | ||
1100 | 1100 | assign_parameter_index_in_region (tree name, sese_info_p region) |
1101 | 1101 | { |
1102 | 1102 | gcc_assert (TREE_CODE (name) == SSA_NAME |
1103 | - && INTEGRAL_TYPE_P (TREE_TYPE (name)) | |
1104 | 1103 | && ! defined_in_sese_p (name, region->region)); |
1105 | 1104 | |
1106 | 1105 | int i; |
@@ -0,0 +1,19 @@ | ||
1 | +/* { dg-do compile } */ | |
2 | +/* { dg-options "-O -floop-nest-optimize" } */ | |
3 | + | |
4 | +int * | |
5 | +eo (void); | |
6 | + | |
7 | +void | |
8 | +g4 (int *nt) | |
9 | +{ | |
10 | + int dh, t2 = (__INTPTR_TYPE__)eo (); | |
11 | + | |
12 | + for (dh = 0; dh < 2; ++dh) | |
13 | + { | |
14 | + int m7; | |
15 | + | |
16 | + for (m7 = 0; m7 < t2; ++m7) | |
17 | + nt[m7] = 0; | |
18 | + } | |
19 | +} |