diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-22 11:19:45 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-22 11:19:45 +0000 |
commit | 80ebf6ea0e8c80163e5dbc80624a70a33390ce11 (patch) | |
tree | 05f70a50455f568a3f9ab371e4e06842510f6504 /gcc | |
parent | 579a615885a5396ada178284a99821300189c21e (diff) | |
download | gcc-80ebf6ea0e8c80163e5dbc80624a70a33390ce11.tar.gz |
2010-04-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43845
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Properly
lookup the CALL_EXPR function and arguments.
* gcc.c-torture/compile/pr43845.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158641 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr43845.c | 12 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.c | 41 |
4 files changed, 51 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a37cc4bec22..659727d9993 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-04-22 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/43845 + * tree-ssa-pre.c (create_component_ref_by_pieces_1): Properly + lookup the CALL_EXPR function and arguments. + 2010-04-22 Nick Clifton <nickc@redhat.com> * config/stormy16/stormy16.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 074b25d39cd..026b4babd3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-04-22 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/43845 + * gcc.c-torture/compile/pr43845.c: New testcase. + 2010-04-22 Bernd Schmidt <bernds@codesourcery.com> PR middle-end/29274 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43845.c b/gcc/testsuite/gcc.c-torture/compile/pr43845.c new file mode 100644 index 00000000000..bdb45e7d2a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43845.c @@ -0,0 +1,12 @@ +typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void); + +typedef struct { + x264_pixel_cmp_t ssd; +} x264_pixel_function_t; + +int x264_pixel_ssd_wxh (x264_pixel_function_t *pf, int i_width) { + int i_ssd = 0, x; + for (x = 0; x < i_width; x++) + i_ssd += pf->ssd(); + return i_ssd; +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 584f6061531..3a81f2c9316 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2631,31 +2631,46 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref, { case CALL_EXPR: { - tree folded, sc = currop->op1; + tree folded, sc = NULL_TREE; unsigned int nargs = 0; - tree *args = XNEWVEC (tree, VEC_length (vn_reference_op_s, - ref->operands) - 1); + tree fn, *args; + if (TREE_CODE (currop->op0) == FUNCTION_DECL) + fn = currop->op0; + else + { + pre_expr op0 = get_or_alloc_expr_for (currop->op0); + fn = find_or_generate_expression (block, op0, stmts, domstmt); + if (!fn) + return NULL_TREE; + } + if (currop->op1) + { + pre_expr scexpr = get_or_alloc_expr_for (currop->op1); + sc = find_or_generate_expression (block, scexpr, stmts, domstmt); + if (!sc) + return NULL_TREE; + } + args = XNEWVEC (tree, VEC_length (vn_reference_op_s, + ref->operands) - 1); while (*operand < VEC_length (vn_reference_op_s, ref->operands)) { args[nargs] = create_component_ref_by_pieces_1 (block, ref, operand, stmts, domstmt); + if (!args[nargs]) + { + free (args); + return NULL_TREE; + } nargs++; } folded = build_call_array (currop->type, - TREE_CODE (currop->op0) == FUNCTION_DECL - ? build_fold_addr_expr (currop->op0) - : currop->op0, + (TREE_CODE (fn) == FUNCTION_DECL + ? build_fold_addr_expr (fn) : fn), nargs, args); free (args); if (sc) - { - pre_expr scexpr = get_or_alloc_expr_for (sc); - sc = find_or_generate_expression (block, scexpr, stmts, domstmt); - if (!sc) - return NULL_TREE; - CALL_EXPR_STATIC_CHAIN (folded) = sc; - } + CALL_EXPR_STATIC_CHAIN (folded) = sc; return folded; } break; |