[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-01-25 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2009-01-25 13:21 ---
As soon as we do not have to properly represent this in the virtual use-def
chains (while still being semi-precise) we can deal with this properly.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964



[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-01-25 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2009-01-25 15:56 ---
One thing to note is that the adjustment we do during inlining means that
we miss that same adjustment iff inlining is disabled and the simple
(placement) new wrappers are marked const (and thus do not appear as memory
barriers in the virtual SSA form).


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-01-25 15:56:59
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964



[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-01-25 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2009-01-25 16:02 ---
Plan for attacking the problem:

 1) Write a verifier that discovers illegal code motion.
   1a) Each store and load is assigned a generation count.
   1b) After code motion optimizations verify that out-of-order stores/loads
   were validly interchanged.  If not, ICE.  If so, re-compute the
   generation counters.
 2) Fix the fallout.  Tree loop store motion is known to randomly
interchange stores.
 3) Profit.
...
 n) Deal with RTL (properly export alias information to RTL).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964



[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-02-02 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2009-02-02 10:24 ---
Nice testcase from PR38503:

inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }

struct Y {
  Y() {}
  int i;
};

struct X {
  X() {}
  void construct(const Y& y)
  {
new (&m_data[0]) Y(y);
  }
  template 
  Y& get() { return reinterpret_cast(m_data); }
  bool initialized;
  char m_data[sizeof (Y)];
};

X x;

void bar(const X&);
void foo(Y& y)
{
  x.get() = y;
  x.initialized = true;
  bar(x);
}

we have to assume that any globally accessible decl has a different dynamic
type than its declared type.  Thus we may not apply TBAA to any ESCAPED
symbol.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964



[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-02-03 Thread rguenth at gcc dot gnu dot org


--- Comment #5 from rguenth at gcc dot gnu dot org  2009-02-03 09:08 ---
The testcase lays the way to proof that whatever PTA ends up putting in
the ESCAPED solution (which includes all globals) TBAA disambiguation
on these is invalid.  This basically means that TBAA is nearly useless, as
if PTA has more precise information we can as well use that.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964



[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-05-22 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2009-05-22 20:41 ---
Subject: Bug 38964

Author: rguenth
Date: Fri May 22 20:41:31 2009
New Revision: 147805

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147805
Log:
2009-05-22  Richard Guenther  

PR middle-end/38964
* alias.c (write_dependence_p): Do not use TBAA for answering
anti-dependence or output-dependence.
* tree-ssa-structalias.c (set_uids_in_ptset): Remove TBAA pruning
code.
(emit_pointer_definition): Remove.
(emit_alias_warning): Likewise.
(find_what_var_points_to): Remove TBAA pruning code.
(find_what_p_points_to): Likewise.  Do not warn about strict-aliasing
violations.
(compute_points_to_sets): Remove code computing the set of
dereferenced pointers.
* tree-data-ref.c (dr_may_alias_p): Properly use the split
oracle for querying anti and output dependencies.
* tree-ssa-alias.c (refs_may_alias_p_1): Add argument specifying
if TBAA may be applied.
(refs_anti_dependent_p): New function.
(refs_output_dependent_p): Likewise.
* tree-ssa-alias.h (refs_anti_dependent_p): Declare.
(refs_output_dependent_p): Likewise.

* doc/tree-ssa.texi (Memory model): New section.

testsuite/
* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: XFAIL.
* gcc.dg/Wstrict-aliasing-converted-assigned.c: Likewise.
* gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c: Likewise.

* doc/c-tree.texi (CHANGE_DYNAMIC_TYPE_EXPR): Remove.
* doc/gimple.texi (GIMPLE_CHANGE_DYNAMIC_TYPE): Remove.

* cfgexpand.c (expand_gimple_basic_block): Do not handle
GIMPLE_CHANGE_DYNAMIC_TYPE or CHANGE_DYNAMIC_TYPE_EXPR.
* expr.c (expand_expr_real_1): Likewise.
* gimple-low.c (lower_stmt): Likewise.
* gimple-pretty-print.c (dump_gimple_stmt): Likewise.
(dump_gimple_cdt): Remove.
* gimple.c (gss_for_code): Do not handle GIMPLE_CHANGE_DYNAMIC_TYPE.
(gimple_size): Likewise.
(walk_gimple_op): Likewise.
(is_gimple_stmt): Likewise.
(walk_stmt_load_store_addr_ops): Likewise.
(gimple_build_cdt): Remove.
* gimple.def (GIMPLE_CHANGE_DYNAMIC_TYPE): Remove.
* gimple.h (gimple_cdt_new_type): Remove.
(gimple_cdt_new_type_ptr): Likewise.
(gimple_cdt_set_new_type): Likewise.
(gimple_cdt_location): Likewise.
(gimple_cdt_location_ptr): Likewise.
(gimple_cdt_set_location): Likewise.
* gimplify.c (gimplify_expr): Do not handle CHANGE_DYNAMIC_TYPE_EXPR.
* tree-cfg.c (remove_useless_stmts_1): Do not handle
GIMPLE_CHANGE_DYNAMIC_TYPE.
(verify_types_in_gimple_stmt): Likewise.
* tree-inline.c (estimate_num_insns): Likewise.
(expand_call_inline): Do not copy DECL_NO_TBAA_P.
(copy_decl_to_var): Likewise.
(copy_result_decl_to_var): Likewise.
* tree-pretty-print.c (dump_generic_node): Do not handle
CHANGE_DYNAMIC_TYPE_EXPR.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise.
* tree-ssa-operands.c (get_expr_operands): Likewise.
* tree-ssa-structalias.c (struct variable_info): Remove
no_tbaa_pruning member.
(new_var_info): Do not set it based on DECL_NO_TBAA_P.
(unify_nodes): Do not copy it.
(find_func_aliases): Do not handle GIMPLE_CHANGE_DYNAMIC_TYPE.
(dump_solution_for_var): Do not dump no_tbaa_pruning state.
(set_uids_in_ptset): Do not check it.
(find_what_var_points_to): Likewise.
(compute_tbaa_pruning): Remove.
(compute_points_to_sets): Do not call it.
* tree.c (walk_tree_1): Do not handle CHANGE_DYNAMIC_TYPE_EXPR.
* tree.def (CHANGE_DYNAMIC_TYPE_EXPR): Remove.
* tree.h (CHANGE_DYNAMIC_TYPE_NEW_TYPE): Remove.
(CHANGE_DYNAMIC_TYPE_LOCATION): Likewise.
(DECL_NO_TBAA_P): Likewise.
(struct tree_decl_common): Move no_tbaa_flag to unused flags section.
* omp-low.c (copy_var_decl): Do not copy DECL_NO_TBAA_P.
(expand_omp_atomic_pipeline): Do not set it.
* print-tree.c (print_node): Do not dump it.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Remove
redundant check.

cp/
* init.c (avoid_placement_new_aliasing): Remove.
(build_new_1): Do not call it.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/alias.c
trunk/gcc/cfgexpand.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/doc/c-tree.texi
trunk/gcc/doc/gimple.texi
trunk/gcc/doc/tree-ssa.texi
trunk/gcc/expr.c
trunk/gcc/gimple-low.c
trunk/gcc/gimple-pretty-print.c
trunk/gcc/gimple.c
trunk/gcc/gimple.def
trunk/gcc/gimple.h
trunk/gcc/gimplify.c
trunk/gcc/omp-low.c
trunk/gcc/print-tree.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tes

[Bug tree-optimization/38964] TBAA side-effects of C++ new still missing

2009-05-22 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2009-05-22 20:42 ---
Fixed for 4.5.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964