public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented
@ 2012-02-06 21:21 patrick.marlier at gmail dot com
  2012-02-06 21:35 ` [Bug middle-end/52142] " patrick.marlier at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: patrick.marlier at gmail dot com @ 2012-02-06 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52142
           Summary: [trans-mem] inlined transaction_pure functions are
                    instrumented
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: patrick.marlier@gmail.com
                CC: aldyh@gcc.gnu.org, rth@gcc.gnu.org


Created attachment 26592
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26592
testcase with -fgnu-tm -O1

In this testcase, the function 'purefunc' has inline and transaction_pure
attribute. In the optimized mode (-O), the function becomes inlined but also
instrumented whereas it was annotated transaction_pure.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
@ 2012-02-06 21:35 ` patrick.marlier at gmail dot com
  2012-02-07  9:28 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: patrick.marlier at gmail dot com @ 2012-02-06 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Patrick Marlier <patrick.marlier at gmail dot com> 2012-02-06 21:35:09 UTC ---
Created attachment 26593
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26593
another testcase but with an asm statement

the asm statement is in a transaction_pure function but diagnose a asm
statement into an atomic transaction.

$ ../gcc/xgcc -B/../gcc/ asm-2.c -fgnu-tm -O0 -S -o asm-2.s
$ ../gcc/xgcc -B/../gcc/ asm-2.c -fgnu-tm -O1 -S -o asm-2.s
asm-2.c:7:3: error: asm not allowed in atomic transaction


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
  2012-02-06 21:35 ` [Bug middle-end/52142] " patrick.marlier at gmail dot com
@ 2012-02-07  9:28 ` rguenth at gcc dot gnu.org
  2012-02-07 17:53 ` rth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-07  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-07
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-07 09:27:46 UTC ---
You'd need to lower transaction_pure into some IL constructs (similar to
how stmts only throw if they are in EH tables, or similar to how we set
TREE_NO_TRAP).  The other variant would be to never inline transaction_pure
functions into non-transaction_pure functions (see can_inline_edge_p
for how we for example check DECL_FUNCTION_SPECIFIC_OPTIMIZATION there).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
  2012-02-06 21:35 ` [Bug middle-end/52142] " patrick.marlier at gmail dot com
  2012-02-07  9:28 ` rguenth at gcc dot gnu.org
@ 2012-02-07 17:53 ` rth at gcc dot gnu.org
  2012-02-14 15:15 ` aldyh at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rth at gcc dot gnu.org @ 2012-02-07 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Henderson <rth at gcc dot gnu.org> 2012-02-07 17:53:14 UTC ---
We were *supposed* to already be disallowing inlining of tm_pure
into non-tm_pure functions.  At least that's what I remember...


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
                   ` (2 preceding siblings ...)
  2012-02-07 17:53 ` rth at gcc dot gnu.org
@ 2012-02-14 15:15 ` aldyh at gcc dot gnu.org
  2012-02-14 17:50 ` rth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-02-14 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-02-14 15:15:36 UTC ---
Created attachment 26659
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26659
proposed patch

Actually Richard (rth), the restriction is less strict than that.  We are
currently disallowing inling of TM_pure functions into TM_safe functions. 
Should we be disallowing TM_pure functions into non-TM_pure functions?  This
approach (attached) definitely fixes the PR.

Please let me know so I can formally submit this patch.

p.s. FYI, the original disallowing came here:
http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01003.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
                   ` (3 preceding siblings ...)
  2012-02-14 15:15 ` aldyh at gcc dot gnu.org
@ 2012-02-14 17:50 ` rth at gcc dot gnu.org
  2012-02-15  0:29 ` aldyh at gcc dot gnu.org
  2012-02-15  0:30 ` aldyh at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rth at gcc dot gnu.org @ 2012-02-14 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Henderson <rth at gcc dot gnu.org> 2012-02-14 17:50:02 UTC ---
The patch in #c4 looks good.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
                   ` (4 preceding siblings ...)
  2012-02-14 17:50 ` rth at gcc dot gnu.org
@ 2012-02-15  0:29 ` aldyh at gcc dot gnu.org
  2012-02-15  0:30 ` aldyh at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-02-15  0:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-02-15 00:29:10 UTC ---
Author: aldyh
Date: Wed Feb 15 00:29:06 2012
New Revision: 184251

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184251
Log:
+       PR middle-end/52142
+       * ipa-inline.c (can_inline_edge_p): Do not inline tm_pure
+       functions into non-tm_pure functions.


Added:
    trunk/gcc/testsuite/gcc.dg/tm/pr52141.c
    trunk/gcc/testsuite/gcc.dg/tm/pr52142.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-inline.c
    trunk/gcc/trans-mem.c


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/52142] [trans-mem] inlined transaction_pure functions are instrumented
  2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
                   ` (5 preceding siblings ...)
  2012-02-15  0:29 ` aldyh at gcc dot gnu.org
@ 2012-02-15  0:30 ` aldyh at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-02-15  0:30 UTC (permalink / raw)
  To: gcc-bugs

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #7 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-02-15 00:30:00 UTC ---
fixed in trunk


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-15  0:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-06 21:21 [Bug middle-end/52142] New: [trans-mem] inlined transaction_pure functions are instrumented patrick.marlier at gmail dot com
2012-02-06 21:35 ` [Bug middle-end/52142] " patrick.marlier at gmail dot com
2012-02-07  9:28 ` rguenth at gcc dot gnu.org
2012-02-07 17:53 ` rth at gcc dot gnu.org
2012-02-14 15:15 ` aldyh at gcc dot gnu.org
2012-02-14 17:50 ` rth at gcc dot gnu.org
2012-02-15  0:29 ` aldyh at gcc dot gnu.org
2012-02-15  0:30 ` aldyh at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).