summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-13 22:21:25 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-13 22:21:25 +0000
commitd8fd6ef989e8335ddea4ccb63e498e2d632ce25a (patch)
tree359c4896609ee7f80473c97fa28f6fc3f69ed247 /gcc/tree-ssa-ccp.c
parent032ce1f8a732e97e0b4ef2a5ad5f2ee0a8d34ad9 (diff)
downloadgcc-d8fd6ef989e8335ddea4ccb63e498e2d632ce25a.tar.gz
2010-01-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42730 * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Add shortcut for offset zero. * gcc.c-torture/compile/pr42730.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155872 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index f3f113c902f..b40dba36d08 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2120,6 +2120,10 @@ maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
&& is_gimple_min_invariant (DECL_INITIAL (base)))
return DECL_INITIAL (base);
+ /* If there is no offset involved simply return the folded base. */
+ if (integer_zerop (offset))
+ return base;
+
/* Try folding *(&B+O) to B.X. */
t = maybe_fold_offset_to_reference (loc, base_addr, offset,
TREE_TYPE (expr));