From 2ce91ad730b32272f3e2aa86c83c2431ceaa0db6 Mon Sep 17 00:00:00 2001 From: dnovillo Date: Thu, 12 Aug 2004 14:34:11 +0000 Subject: PR tree-optimization/16867 * tree.c (is_global_var): New function. (needs_to_live_in_memory): Check for TREE_ADDRESSABLE. Call is_global_var. * tree.h (DECL_NEEDS_TO_LIVE_IN_MEMORY_INTERNAL): Remove. Update all users. (is_global_var): Declare. * tree-dfa.c (dump_variable): Display global and addressable attributes. (add_referenced_var): Clarify documentation when marking variables call-clobbered. * tree-flow-inline.h (is_call_clobbered): Call is_global_var instead of needs_to_live_in_memory. (mark_call_clobbered): If the variable is a tag, mark it DECL_EXTERNAL. * tree-gimple.c (is_gimple_reg): Don't check for TREE_ADDRESSABLE. (is_gimple_non_addressable): Likewise. * tree-ssa-alias.c (get_nmt_for): Always check whether the tag needs to be marked call-clobbered. (setup_pointers_and_addressables): Call is_global_var instead of needs_to_live_in_memory. * tree-ssa-dce.c (need_to_preserve_store): Remove. Update all users with is_global_var. (mark_stmt_if_obviously_necessary): Fix processing of aliased stores. Don't check the virtual definitions. Rather, check whether the store is going into global memory. (find_obviously_necessary_stmts): Get the symbol from the PHI result. * tree-ssa-operands.c (get_call_expr_operands): Do not add clobbering may-defs if the call does not have side effects. libjava/ChangeLog PR tree-optimization/16867 * testsuite/libjava.lang/PR16867.java: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85874 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 5 +++++ libjava/testsuite/libjava.lang/PR16867.java | 17 +++++++++++++++++ libjava/testsuite/libjava.lang/PR16867.out | 1 + 3 files changed, 23 insertions(+) create mode 100644 libjava/testsuite/libjava.lang/PR16867.java create mode 100644 libjava/testsuite/libjava.lang/PR16867.out (limited to 'libjava') diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1d2af7aba92..54e307cc844 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2004-08-12 Diego Novillo + + PR tree-optimization/16867 + * testsuite/libjava.lang/PR16867.java: New test. + 2004-08-09 Per Bothner * gcj/javaprims.h (_Jv_Utf8Const): Change struct to a class, diff --git a/libjava/testsuite/libjava.lang/PR16867.java b/libjava/testsuite/libjava.lang/PR16867.java new file mode 100644 index 00000000000..6862892304f --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR16867.java @@ -0,0 +1,17 @@ +/* SSA-DCE was removing the initialization of the temporary object + in getFoo because it wasn't realizing that the pointer was needed + outside of it. */ + +public class PR16867 +{ + public static Object[] getFoo() + { + return new Object[] {"OK"}; + } + + public static void main(String[] args) + { + Object[] a = getFoo(); + System.out.println(a[0]); + } +} diff --git a/libjava/testsuite/libjava.lang/PR16867.out b/libjava/testsuite/libjava.lang/PR16867.out new file mode 100644 index 00000000000..d86bac9de59 --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR16867.out @@ -0,0 +1 @@ +OK -- cgit v1.2.3