diff options
author | Richard Guenther <rguenth@gcc.gnu.org> | 2005-06-01 18:43:02 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2005-06-01 18:43:02 +0000 |
commit | 095ecc24ec1340eb0f3d1f06f5bf627001b51d32 (patch) | |
tree | 991227bc41638e17a027fb12fa3ce93c50321a30 /gcc/tree-inline.c | |
parent | 82c0180d7797e3602a7069dbf5696b487be5d7d8 (diff) | |
download | gcc-095ecc24ec1340eb0f3d1f06f5bf627001b51d32.zip gcc-095ecc24ec1340eb0f3d1f06f5bf627001b51d32.tar.gz gcc-095ecc24ec1340eb0f3d1f06f5bf627001b51d32.tar.bz2 |
tree.h (fold_indirect_ref_1): Export from fold-const.c.
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org>
* tree.h (fold_indirect_ref_1): Export from fold-const.c.
* fold-const.c (fold_indirect_ref_1): No longer static.
* tree-inline.c (copy_body_r): Use fold_indirect_ref_1 for
folding, if possible.
From-SVN: r100458
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 224004e..28bdf6c 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -615,13 +615,17 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) it manually here as we'll eventually get ADDR_EXPRs which lie about their types pointed to. In this case build_fold_indirect_ref wouldn't strip the INDIRECT_REF, - but we absolutely rely on that. */ - if (TREE_CODE ((tree)n->value) == ADDR_EXPR) - *tp = TREE_OPERAND ((tree)n->value, 0); - else - *tp = build1 (INDIRECT_REF, - TREE_TYPE (TREE_TYPE ((tree)n->value)), - (tree)n->value); + but we absolutely rely on that. As fold_indirect_ref + does other useful transformations, try that first, though. */ + tree type = TREE_TYPE (TREE_TYPE ((tree)n->value)); + *tp = fold_indirect_ref_1 (type, (tree)n->value); + if (! *tp) + { + if (TREE_CODE ((tree)n->value) == ADDR_EXPR) + *tp = TREE_OPERAND ((tree)n->value, 0); + else + *tp = build1 (INDIRECT_REF, type, (tree)n->value); + } *walk_subtrees = 0; return NULL; } |