diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-12-28 15:56:51 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-12-28 07:56:51 -0800 |
commit | 0e256a822b855ecae6b5ef593b30a7e2e522e6d1 (patch) | |
tree | e87421c97610dec778e8bfad5e457ab9d38f46cb | |
parent | 2b0729bafa0d29686bccee7b698782bec41544e5 (diff) | |
download | gcc-0e256a822b855ecae6b5ef593b30a7e2e522e6d1.zip gcc-0e256a822b855ecae6b5ef593b30a7e2e522e6d1.tar.gz gcc-0e256a822b855ecae6b5ef593b30a7e2e522e6d1.tar.bz2 |
fold-const.c (fold_build_cleanup_point_expr): For a RETURN_EXPR...
2004-12-28 Andrew Pinski <pinskia@physics.uc.edu>
* fold-const.c (fold_build_cleanup_point_expr): For a RETURN_EXPR,
we only need a cleanup point expression when the expression on the
left hand side of the MODIFIY_EXPR inside the return has side
effects.
From-SVN: r92672
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fold-const.c | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af19fd8..ba2abe3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-12-28 Andrew Pinski <pinskia@physics.uc.edu> + + * fold-const.c (fold_build_cleanup_point_expr): For a RETURN_EXPR, + we only need a cleanup point expression when the expression on the + left hand side of the MODIFIY_EXPR inside the return has side + effects. + 2004-12-28 Dorit Naishlos <dorit@il.ibm.com> * tree-vectorizer.c (vect_mark_relevant) First argument changed from diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8f8624c..5006998 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10783,6 +10783,21 @@ fold_build_cleanup_point_expr (tree type, tree expr) it with a cleanup point expression. */ if (!TREE_SIDE_EFFECTS (expr)) return expr; + + /* If the expression is a return, check to see if the expression inside the + return has no side effects or the right hand side of the modify expression + inside the return. If either don't have side effects set we don't need to + wrap the expression in a cleanup point expression. Note we don't check the + left hand side of the modify because it should always be a return decl. */ + if (TREE_CODE (expr) == RETURN_EXPR) + { + tree op = TREE_OPERAND (expr, 0); + if (!op || !TREE_SIDE_EFFECTS (op)) + return expr; + op = TREE_OPERAND (op, 1); + if (!TREE_SIDE_EFFECTS (op)) + return expr; + } return build1 (CLEANUP_POINT_EXPR, type, expr); } |