aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2012-02-15 00:29:06 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2012-02-15 00:29:06 +0000
commita7ff6e2725731539c2f122618c97847069a9a6aa (patch)
tree2c16b036b6df96a695142714e48c0d7df1a609a3 /gcc
parent6bb69d875917aeb57e2ef03a1c77532dd00b7b45 (diff)
downloadgcc-a7ff6e2725731539c2f122618c97847069a9a6aa.zip
gcc-a7ff6e2725731539c2f122618c97847069a9a6aa.tar.gz
gcc-a7ff6e2725731539c2f122618c97847069a9a6aa.tar.bz2
+ PR middle-end/52142 + * ipa-inline.c (can_inline_edge_p): Do not inline...
+ PR middle-end/52142 + * ipa-inline.c (can_inline_edge_p): Do not inline tm_pure + functions into non-tm_pure functions. From-SVN: r184251
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-inline.c6
-rw-r--r--gcc/testsuite/gcc.dg/tm/pr52141.c21
-rw-r--r--gcc/testsuite/gcc.dg/tm/pr52142.c22
-rw-r--r--gcc/trans-mem.c4
5 files changed, 56 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f7f2169..b3d1b9c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-14 Aldy Hernandez <aldyh@redhat.com>
+
+ PR middle-end/52142
+ * ipa-inline.c (can_inline_edge_p): Do not inline tm_pure
+ functions into non-tm_pure functions.
+
2012-02-14 Eric Botcazou <ebotcazou@adacore.com>
PR lto/52178
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 8f8899f..d7ccf68 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -284,10 +284,10 @@ can_inline_edge_p (struct cgraph_edge *e, bool report)
e->inline_failed = CIF_EH_PERSONALITY;
inlinable = false;
}
- /* TM pure functions should not get inlined if the outer function is
- a TM safe function. */
+ /* TM pure functions should not be inlined into non-TM_pure
+ functions. */
else if (is_tm_pure (callee->decl)
- && is_tm_safe (e->caller->decl))
+ && !is_tm_pure (e->caller->decl))
{
e->inline_failed = CIF_UNSPECIFIED;
inlinable = false;
diff --git a/gcc/testsuite/gcc.dg/tm/pr52141.c b/gcc/testsuite/gcc.dg/tm/pr52141.c
new file mode 100644
index 0000000..c5136f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr52141.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O1" } */
+
+inline void asmfunc(void)
+{
+ __asm__ (""); /* { dg-error "asm not allowed in .transaction_safe" } */
+}
+
+__attribute__((transaction_safe))
+static void f(void)
+{
+ asmfunc();
+}
+
+int main()
+{
+ __transaction_atomic {
+ f();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tm/pr52142.c b/gcc/testsuite/gcc.dg/tm/pr52142.c
new file mode 100644
index 0000000..21d4a0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr52142.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O1" } */
+static int global = 0;
+
+__attribute__((transaction_pure))
+static inline void purefunc()
+{
+ global++;
+}
+
+__attribute__((transaction_safe))
+void f();
+
+void push()
+{
+ __transaction_atomic {
+ f();
+ purefunc();
+ }
+}
+
+/* { dg-final { scan-assembler-not "_ITM_RfWU4" } } */
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index d760db3..b7320b5 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -3736,6 +3736,10 @@ ipa_tm_scan_irr_block (basic_block bb)
assembly statement is not relevant to the transaction
is to wrap it in a __tm_waiver block. This is not
yet implemented, so we can't check for it. */
+ if (is_tm_safe (current_function_decl))
+ error_at (gimple_location (stmt),
+ "asm not allowed in %<transaction_safe%> function %qE",
+ current_function_decl);
return true;
default: