summaryrefslogtreecommitdiff
path: root/gcc/tree-flow-inline.h
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-16 08:50:46 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-16 08:50:46 +0000
commitd4993ceea8a9dd8d5650f01631399fe6f2fabcfd (patch)
tree89ab08745815f374219ed6e82d3b8d681e4529c1 /gcc/tree-flow-inline.h
parent8be3e890f81388a70300cac1a8f4ad0f44a0149f (diff)
downloadgcc-d4993ceea8a9dd8d5650f01631399fe6f2fabcfd.tar.gz
2009-09-16 Richard Guenther <rguenther@suse.de>
PR middle-end/34011 * tree-flow-inline.h (may_be_aliased): Compute readonly variables as non-aliased. * gcc.dg/tree-ssa/ssa-lim-7.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151740 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r--gcc/tree-flow-inline.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index eef2f4324a9..fdb33378bee 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -616,12 +616,18 @@ is_global_var (const_tree t)
/* Return true if VAR may be aliased. A variable is considered as
maybe aliased if it has its address taken by the local TU
- or possibly by another TU. */
+ or possibly by another TU and might be modified through a pointer. */
static inline bool
may_be_aliased (const_tree var)
{
- return (TREE_PUBLIC (var) || DECL_EXTERNAL (var) || TREE_ADDRESSABLE (var));
+ return (TREE_CODE (var) != CONST_DECL
+ && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
+ && TREE_READONLY (var)
+ && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
+ && (TREE_PUBLIC (var)
+ || DECL_EXTERNAL (var)
+ || TREE_ADDRESSABLE (var)));
}