On Fri, Apr 01, 2016 at 11:44:16AM +0200, Richard Biener wrote:
> On Fri, 1 Apr 2016, Jakub Jelinek wrote:
> 
> > On Fri, Apr 01, 2016 at 11:08:09AM +0200, Richard Biener wrote:
> > > 
> > > RTL DSE uses true_dependence to see whether a store may be killed by
> > > anothe store - that's obviously broken.  The following patch makes
> > > it use output_dependence instead (introducing a canon_ variant of that).
> > 
> > I think it would be interesting to see some stats on what effect does this
> > have on the optimization RTL DSE is doing (say gather during
> > unpatched bootstrap/regtest number of successfully optimized replace_read
> > calls, and the same with patched bootstrap/regtest).

So, I've gathered the stats, with:
--- gcc/dse.c.jj        2016-03-02 10:47:25.000000000 +0100
+++ gcc/dse.c   2016-04-01 15:01:18.831249250 +0200
@@ -2047,6 +2047,11 @@ replace_read (store_info *store_info, in
          print_simple_rtl (dump_file, read_reg);
          fprintf (dump_file, "\n");
        }
+{
+FILE *f = fopen ("/tmp/dse2", "a");
+fprintf (f, "%d %s %s\n", (int) BITS_PER_WORD, main_input_filename ? 
main_input_filename : "-", current_function_name ());
+fclose (f);
+}
       return true;
     }
   else
with my usual pair of rtl,yes checking bootstraps/regtests (x86_64-linux
and i686-linux, former one with ada, latter without), both without your
patch and with the patch.
Without the patch got 66555 successful replace_reads, with your patch
only 65971, that is 1% difference.  I guess that is acceptable level,
though for GCC 7 we should try to improve that (either at the GIMPLE level,
or do something better at the RTL level).

A few randomly chosen cases where we don't optimize this anymore:
32 ../../gcc/tree-ssa-structalias.c variable_info* 
create_variable_info_for_1(tree, const char*, bool, bool, bitmap)
32 /home/jakub/src/gcc/gcc/testsuite/gcc.c-torture/compile/pr42237.c foo
32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr62167.c main
32 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/avx-vdppd-2.c do_test
32 /home/jakub/src/gcc/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc 
std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::unique_ptr<_Up, _Ep>&&) [with 
_Tp1 = X; _Del = std::default_delete<X>; <template-parameter-2-3> = void; _Tp = 
X; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]
32 
/home/jakub/src/gcc/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/68863.cc
 
std::__detail::_Compiler<_TraitsT>::_Compiler(std::__detail::_Compiler<_TraitsT>::_IterT,
 std::__detail::_Compiler<_TraitsT>::_IterT, const typename 
_TraitsT::locale_type&, std::__detail::_Compiler<_TraitsT>::_FlagT) [with 
_TraitsT = std::__cxx11::regex_traits<char>]
32 ../../../libgo/go/crypto/x509/cert_pool.go x509.CreateCertificateRequest
64 ../../gcc/gimple-streamer-in.c void input_bb(lto_input_block*, LTO_tags, 
data_in*, function*, int)
64 /home/jakub/src/gcc/gcc/ada/switch-m.adb 
Switch.M.Normalize_Compiler_Switches.Add_Switch_Component
64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/sse4_1-dppd-2.c do_test
64 
/home/jakub/src/gcc/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy_assign.cc
 void std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, 
_Hash, _RehashPolicy, _Traits>::_M_assign(const std::_Hashtable<_Key, _Value, 
_Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>&, const 
_NodeGenerator&) [with _NodeGenerator = std::_Hashtable<_Key, _Value, _Alloc, 
_ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::operator=(const 
std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, 
_RehashPolicy, _Traits>&) [with _Key = T; _Value = std::pair<const T, T>; 
_Alloc = __gnu_test::propagating_allocator<T, true>; _ExtractKey = 
std::__detail::_Select1st; _Equal = equal_to; _H1 = hash; _H2 = 
std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; 
_RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = 
std::__detail::_Hashtable_traits<false, false, true>]::<lambda(const 
__node_type*)>; _Key = T; _Value = std::pair<const T, T>; _Alloc = 
__gnu_test::propagating_allocator<T, true>; _ExtractKey = 
std::__detail::_Select1st; _Equal = equal_to; _H1 = hash; _H2 = 
std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; 
_RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = 
std::__detail::_Hashtable_traits<false, false, true>]

        Jakub

Reply via email to