+ * ipa-inline.c (can_inline_edge_p): Do not inline tm_pure
+ functions into non-tm_pure functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184251
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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;
--- /dev/null
+/* { 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;
+}
--- /dev/null
+/* { 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" } } */
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: