diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-04 12:34:06 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-04 12:34:06 +0000 |
commit | 5a41d783acbed929d6fe7da7dfe989e4953bc454 (patch) | |
tree | e03429ddfdb28c26c0b8a6b943ec84b3196db8b1 /gcc/tree-ssa-forwprop.c | |
parent | da8e87834082d6cd5c2f82c38285f702bb280de1 (diff) | |
download | gcc-5a41d783acbed929d6fe7da7dfe989e4953bc454.tar.gz |
* fold-const.c (fold_unary_loc): Don't optimize
POINTER_PLUS_EXPR casted to TYPE_RESTRICT pointer by
casting the inner pointer if it isn't TYPE_RESTRICT.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't through
casts from non-TYPE_RESTRICT pointer to TYPE_RESTRICT pointer.
* gcc.dg/tree-ssa/restrict-4.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179500 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index a8737dac933..c6b92cfe77f 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -804,6 +804,11 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, && ((rhs_code == SSA_NAME && rhs == name) || CONVERT_EXPR_CODE_P (rhs_code))) { + /* Don't propagate restrict pointer's RHS. */ + if (TYPE_RESTRICT (TREE_TYPE (lhs)) + && !TYPE_RESTRICT (TREE_TYPE (name)) + && !is_gimple_min_invariant (def_rhs)) + return false; /* Only recurse if we don't deal with a single use or we cannot do the propagation to the current statement. In particular we can end up with a conversion needed for a non-invariant |