Message ID | alpine.DEB.2.02.1610271214001.7692@laptop-mg.saclay.inria.fr |
---|---|
State | New |
Headers | show |
Ping https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02220.html On Thu, 27 Oct 2016, Marc Glisse wrote: > Hello, > > some optimization patch I was working on simplified __TMC_END__ - > __TMC_LIST__ == 0 to false, which is not wanted (I assume that's why it > wasn't written __TMC_END__ == __TMC_LIST__ in the first place). > > Bootstrap+regtest on powerpc64le-unknown-linux-gnu. > > 2016-10-27 Marc Glisse <marc.glisse@inria.fr> > > PR libgcc/77813 > * crtstuff.c (deregister_tm_clones, register_tm_clones): Hide > __TMC_END__ behind a passthrough asm. -- Marc Glisse
On Fri, Nov 4, 2016 at 7:08 AM, Marc Glisse <marc.glisse@inria.fr> wrote: > Ping https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02220.html I think this is obvious. Thanks, Andrew > > > On Thu, 27 Oct 2016, Marc Glisse wrote: > >> Hello, >> >> some optimization patch I was working on simplified __TMC_END__ - >> __TMC_LIST__ == 0 to false, which is not wanted (I assume that's why it >> wasn't written __TMC_END__ == __TMC_LIST__ in the first place). >> >> Bootstrap+regtest on powerpc64le-unknown-linux-gnu. >> >> 2016-10-27 Marc Glisse <marc.glisse@inria.fr> >> >> PR libgcc/77813 >> * crtstuff.c (deregister_tm_clones, register_tm_clones): Hide >> __TMC_END__ behind a passthrough asm. > > > -- > Marc Glisse
On Fri, 4 Nov 2016, Andrew Pinski wrote: > On Fri, Nov 4, 2016 at 7:08 AM, Marc Glisse <marc.glisse@inria.fr> wrote: >> Ping https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02220.html > > I think this is obvious. Ok, I've committed it. -- Marc Glisse
Index: libgcc/crtstuff.c =================================================================== --- libgcc/crtstuff.c (revision 241611) +++ libgcc/crtstuff.c (working copy) @@ -273,41 +273,47 @@ STATIC func_ptr __TMC_LIST__[] # ifdef HAVE_GAS_HIDDEN extern func_ptr __TMC_END__[] __attribute__((__visibility__ ("hidden"))); # endif static inline void deregister_tm_clones (void) { void (*fn) (void *); #ifdef HAVE_GAS_HIDDEN - if (__TMC_END__ - __TMC_LIST__ == 0) + func_ptr *end = __TMC_END__; + // Do not optimize the comparison to false. + __asm ("" : "+g" (end)); + if (__TMC_LIST__ == end) return; #else if (__TMC_LIST__[0] == NULL) return; #endif fn = _ITM_deregisterTMCloneTable; __asm ("" : "+r" (fn)); if (fn) fn (__TMC_LIST__); } static inline void register_tm_clones (void) { void (*fn) (void *, size_t); size_t size; #ifdef HAVE_GAS_HIDDEN - size = (__TMC_END__ - __TMC_LIST__) / 2; + func_ptr *end = __TMC_END__; + // Do not optimize the comparison to false. + __asm ("" : "+g" (end)); + size = (end - __TMC_LIST__) / 2; #else for (size = 0; __TMC_LIST__[size * 2] != NULL; size++) continue; #endif if (size == 0) return; fn = _ITM_registerTMCloneTable; __asm ("" : "+r" (fn)); if (fn)