diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-18 15:13:54 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-18 15:13:54 +0000 |
commit | 91995195ea075a94c9dcaa36d7212d3a9d78c2ad (patch) | |
tree | ac6d85de16d80fdad124ecf877b09fc745dc5d89 /gcc/gimple.c | |
parent | c4862d10a774446c4879cefe2bc0bb27c9f36e32 (diff) | |
download | gcc-91995195ea075a94c9dcaa36d7212d3a9d78c2ad.tar.gz |
2011-11-18 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50605
* gimple.c (is_gimple_ip_invariant_address): Also handle MEM_REFs
of IPA invariant decls.
* testsuite/g++.dg/ipa/pr50605.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181477 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r-- | gcc/gimple.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index 6168d33ac05..071c6515b4c 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2858,8 +2858,18 @@ is_gimple_ip_invariant_address (const_tree t) return false; op = strip_invariant_refs (TREE_OPERAND (t, 0)); + if (!op) + return false; + + if (TREE_CODE (op) == MEM_REF) + { + const_tree op0 = TREE_OPERAND (op, 0); + return (TREE_CODE (op0) == ADDR_EXPR + && (CONSTANT_CLASS_P (TREE_OPERAND (op0, 0)) + || decl_address_ip_invariant_p (TREE_OPERAND (op0, 0)))); + } - return op && (CONSTANT_CLASS_P (op) || decl_address_ip_invariant_p (op)); + return CONSTANT_CLASS_P (op) || decl_address_ip_invariant_p (op); } /* Return true if T is a GIMPLE minimal invariant. It's a restricted |