This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/33199] [4.3 Regression] tr1/2_general_utilities/shared_ptr/assign/auto_ptr.cc
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Aug 2007 11:58:31 -0000
- Subject: [Bug middle-end/33199] [4.3 Regression] tr1/2_general_utilities/shared_ptr/assign/auto_ptr.cc
- References: <bug-33199-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #20 from rguenth at gcc dot gnu dot org 2007-08-29 11:58 -------
Due to the alias differences with -g compared to without -g we have the
following
difference after tree-level optimization:
--- - 2007-08-29 13:52:02.567822000 +0200
+++ b/auto_ptr.min.ii.116t.optimized 2007-08-29 13:51:05.000000000 +0200
@@ -505,6 +505,7 @@ int test01() ()
D.8890 = (struct _Sp_counted_base_impl *) D.8889;
__d = __d.79;
D.8891 = &D.8890->D.8307;
+ D.8890->D.8307._vptr._Sp_counted_base =
&_ZTVNSt3tr116_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE1EEE[2];
D.8890->D.8307._M_use_count = 1;
D.8890->D.8307._M_weak_count = 1;
D.8890->D.8307._vptr._Sp_counted_base =
&_ZTVNSt3tr121_Sp_counted_base_implIP1BNS_11_Sp_deleterIS1_EELN9__gnu_cxx12_Lock_policyE1EEE[2];
@@ -529,9 +530,9 @@ Invalid sum of incoming frequencies 8500
goto <bb 9>;
<bb 8>:
- D.8898 = D.8890->D.8307._M_use_count + 1;
- *D.8895 ={v} D.8898;
__result = D.8890->D.8307._M_use_count;
+ D.8898 = __result + 1;
+ *D.8895 ={v} D.8898;
D.9413 = __result + -1;
*D.8895 ={v} D.9413;
goto <bb 11>;
that is, we have one dead store removed by DSE and PRE removes one load of
_M_use_count:
int test01() ()
{
+ _Atomic_word prephitmp.476;
+ _Atomic_word pretmp.475;
int storetmp.473;
volatile _Atomic_word * __mem.22;
_Atomic_word __result;
@@ -3806,9 +3836,11 @@ Invalid sum of incoming frequencies 8415
goto <bb 13>;
<bb 29>:
+ pretmp.475_164 = D.8890_24->D.8307._M_use_count;
<bb 12>:
- __result_86 = D.8890_24->D.8307._M_use_count;
+ # prephitmp.476_144 = PHI <pretmp.475_164(29), D.8897_31(8)>
+ __result_86 = prephitmp.476_144;
D.9413_88 = __result_86 + -1;
*D.8895_29 ={v} D.9413_88;
before PRE this looks like
<bb 6>:
Invalid sum of incoming frequencies 8500, should be 7225
D.8895_29 = &D.8890_24->D.8307._M_use_count;
...
<bb 8>:
# VUSE <SMT.465_361, SMT.466_362>
D.8897_31 = D.8890_24->D.8307._M_use_count;
D.8898_32 = D.8897_31 + 1;
# ctor_count_373 = VDEF <ctor_count_344(ab)>
# ctor_count_374 = VDEF <ctor_count_345(ab)>
# dtor_count_375 = VDEF <dtor_count_346(ab)>
*D.8895_29 ={v} D.8898_32;
goto <bb 12>;
...
<bb 29>:
<bb 12>:
# MPT.471_203 = PHI <MPT.471_280(29), MPT.471_351(ab)(8)>
# SMT.470_61 = PHI <SMT.470_260(29), SMT.470_350(ab)(8)>
# SMT.467_59 = PHI <SMT.467_240(29), SMT.467_349(ab)(8)>
# SMT.466_58 = PHI <SMT.466_220(29), SMT.466_362(8)>
# SMT.465_54 = PHI <SMT.465_200(29), SMT.465_361(8)>
# dtor_count_53 = PHI <dtor_count_180(29), dtor_count_375(8)>
# ctor_count_52 = PHI <ctor_count_160(29), ctor_count_374(8)>
# ctor_count_48 = PHI <ctor_count_140(29), ctor_count_373(8)>
# VUSE <SMT.465_54, SMT.466_58>
__result_86 = D.8890_24->D.8307._M_use_count;
D.9413_88 = __result_86 + -1;
# ctor_count_449 = VDEF <ctor_count_48>
# ctor_count_450 = VDEF <ctor_count_52>
# dtor_count_451 = VDEF <dtor_count_53>
*D.8895_29 ={v} D.9413_88;
forwprop doesn't propagate the address expr &D.8890_24->D.8307._M_use_count
to the dereference because the dereference site has volatile ops. But
you can see from <bb 8> that we have wrong alias info there - the load
does not use the ctor_count and dtor_count syms and the store does not
def the two SMTs.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33199