public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] hardcfr: fix -fgnu-tm empty asm
@ 2023-06-29 18:42 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2023-06-29 18:42 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:657ff673e5a1b249f86e8ecb3febcabc69f9974a

commit 657ff673e5a1b249f86e8ecb3febcabc69f9974a
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Jun 29 15:39:24 2023 -0300

    hardcfr: fix -fgnu-tm empty asm

Diff:
---
 gcc/trans-mem.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gcc/trans-mem.cc b/gcc/trans-mem.cc
index 9c3d1121a03..1167179986f 100644
--- a/gcc/trans-mem.cc
+++ b/gcc/trans-mem.cc
@@ -754,6 +754,12 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_ASM:
+      // Allow empty asm statements.  These may be used to
+      // stabilize or detach values, but since they do nothing,
+      // they do not harm transactions.
+      if (!*gimple_asm_string (as_a <gasm *>(stmt)))
+	break;
+
       /* ??? We ought to come up with a way to add attributes to
 	 asm statements, and then add "transaction_safe" to it.
 	 Either that or get the language spec to resurrect __tm_waiver.  */
@@ -1776,6 +1782,11 @@ lower_sequence_tm (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_ASM:
+      // Allow empty asm statements.  These may be used to
+      // stabilize or detach values, but since they do nothing,
+      // they do not harm transactions.
+      if (!*gimple_asm_string (as_a <gasm *>(stmt)))
+	break;
       *state |= GTMA_MAY_ENTER_IRREVOCABLE;
       break;
 
@@ -2653,6 +2664,11 @@ expand_block_tm (struct tm_region *region, basic_block bb)
 	  break;
 
 	case GIMPLE_ASM:
+	  // Allow empty asm statements.  These may be used to
+	  // stabilize or detach values, but since they do nothing,
+	  // they do not harm transactions.
+	  if (!*gimple_asm_string (as_a <gasm *>(gsi_stmt (gsi))))
+	    break;
 	  gcc_unreachable ();
 
 	default:
@@ -4423,6 +4439,12 @@ ipa_tm_scan_irr_block (basic_block bb)
 	  }
 
 	case GIMPLE_ASM:
+	  // Allow empty asm statements.  These may be used to
+	  // stabilize or detach values, but since they do nothing,
+	  // they do not harm transactions.
+	  if (!*gimple_asm_string (as_a <gasm *>(gsi_stmt (gsi))))
+	    break;
+
 	  /* ??? The Approved Method of indicating that an inline
 	     assembly statement is not relevant to the transaction
 	     is to wrap it in a __tm_waiver block.  This is not

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

* [gcc(refs/users/aoliva/heads/testme)] hardcfr: fix -fgnu-tm empty asm
@ 2023-09-29 22:11 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2023-09-29 22:11 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:bd03168dac26f2f2f1529e477e8482c60cdbbc30

commit bd03168dac26f2f2f1529e477e8482c60cdbbc30
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jul 3 18:09:36 2023 -0300

    hardcfr: fix -fgnu-tm empty asm

Diff:
---
 gcc/trans-mem.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gcc/trans-mem.cc b/gcc/trans-mem.cc
index 9c3d1121a03..1167179986f 100644
--- a/gcc/trans-mem.cc
+++ b/gcc/trans-mem.cc
@@ -754,6 +754,12 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_ASM:
+      // Allow empty asm statements.  These may be used to
+      // stabilize or detach values, but since they do nothing,
+      // they do not harm transactions.
+      if (!*gimple_asm_string (as_a <gasm *>(stmt)))
+	break;
+
       /* ??? We ought to come up with a way to add attributes to
 	 asm statements, and then add "transaction_safe" to it.
 	 Either that or get the language spec to resurrect __tm_waiver.  */
@@ -1776,6 +1782,11 @@ lower_sequence_tm (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_ASM:
+      // Allow empty asm statements.  These may be used to
+      // stabilize or detach values, but since they do nothing,
+      // they do not harm transactions.
+      if (!*gimple_asm_string (as_a <gasm *>(stmt)))
+	break;
       *state |= GTMA_MAY_ENTER_IRREVOCABLE;
       break;
 
@@ -2653,6 +2664,11 @@ expand_block_tm (struct tm_region *region, basic_block bb)
 	  break;
 
 	case GIMPLE_ASM:
+	  // Allow empty asm statements.  These may be used to
+	  // stabilize or detach values, but since they do nothing,
+	  // they do not harm transactions.
+	  if (!*gimple_asm_string (as_a <gasm *>(gsi_stmt (gsi))))
+	    break;
 	  gcc_unreachable ();
 
 	default:
@@ -4423,6 +4439,12 @@ ipa_tm_scan_irr_block (basic_block bb)
 	  }
 
 	case GIMPLE_ASM:
+	  // Allow empty asm statements.  These may be used to
+	  // stabilize or detach values, but since they do nothing,
+	  // they do not harm transactions.
+	  if (!*gimple_asm_string (as_a <gasm *>(gsi_stmt (gsi))))
+	    break;
+
 	  /* ??? The Approved Method of indicating that an inline
 	     assembly statement is not relevant to the transaction
 	     is to wrap it in a __tm_waiver block.  This is not

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

end of thread, other threads:[~2023-09-29 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 18:42 [gcc(refs/users/aoliva/heads/testme)] hardcfr: fix -fgnu-tm empty asm Alexandre Oliva
2023-09-29 22:11 Alexandre Oliva

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).