@@ -1,3 +1,10 @@
+2011-10-28 Torvald Riegel <triegel@redhat.com>
+
+ * trans-mem.c (lower_transaction): Also add an "over" laber for outer
+ transactions.
+ (expand_transactions): Do not set hasNoAbort for outer transactions.
+ * testsuite/gcc.dg/tm/props-4.c: New file.
+
2011-10-27 Torvald Riegel <triegel@redhat.com>
* trans-mem.c (ipa_tm_transform_transaction): Insert explicit request
new file mode 100644
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmedge -fdump-tree-tmmark" } */
+
+int a, b;
+
+void __attribute((transaction_may_cancel_outer,noinline)) cancel1()
+{
+ __transaction_cancel [[outer]];
+}
+
+void
+foo(void)
+{
+ __transaction_atomic [[outer]] {
+ a = 2;
+ __transaction_atomic {
+ b = 2;
+ cancel1();
+ }
+ }
+}
+
+/* { dg-final { scan-tree-dump-times " instrumentedCode" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "hasNoAbort" 0 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "LABEL=<L0>" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
@@ -1603,8 +1603,10 @@ lower_transaction (gimple_stmt_iterator *gsi, struct walk_stmt_info *wi)
gimple_transaction_set_body (stmt, NULL);
- /* If the transaction calls abort, add an "over" label afterwards. */
- if (this_state & GTMA_HAVE_ABORT)
+ /* If the transaction calls abort or if this is an outer transaction,
+ add an "over" label afterwards. */
+ if ((this_state & (GTMA_HAVE_ABORT))
+ || (gimple_transaction_subcode(stmt) & GTMA_IS_OUTER))
{
tree label = create_artificial_label (UNKNOWN_LOCATION);
gimple_transaction_set_label (stmt, label);
@@ -2563,7 +2565,10 @@ expand_transaction (struct tm_region *region)
flags = PR_INSTRUMENTEDCODE;
if ((subcode & GTMA_MAY_ENTER_IRREVOCABLE) == 0)
flags |= PR_HASNOIRREVOCABLE;
- if ((subcode & GTMA_HAVE_ABORT) == 0)
+ /* If the transaction does not have an abort in lexical scope and is not
+ marked as an outer transaction, then it will never abort. */
+ if ((subcode & GTMA_HAVE_ABORT) == 0
+ && (subcode & GTMA_IS_OUTER) == 0)
flags |= PR_HASNOABORT;
if ((subcode & GTMA_HAVE_STORE) == 0)
flags |= PR_READONLY;