public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] hardcfr: prevent deferred sets of visited bitmap
Date: Thu, 20 Oct 2022 05:46:02 +0000 (GMT)	[thread overview]
Message-ID: <20221020054602.265CC385E03D@sourceware.org> (raw)

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

commit bacbf8a89d79238228344cbe41444b565ec4979c
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Wed Oct 19 20:36:28 2022 -0300

    hardcfr: prevent deferred sets of visited bitmap

Diff:
---
 gcc/gimple-harden-control-flow.cc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gcc/gimple-harden-control-flow.cc b/gcc/gimple-harden-control-flow.cc
index 1ea47615cd4..4d40fc98779 100644
--- a/gcc/gimple-harden-control-flow.cc
+++ b/gcc/gimple-harden-control-flow.cc
@@ -545,6 +545,26 @@ class rt_bb_visited
     gassign *vstore = gimple_build_assign (unshare_expr (setme), temp);
     gimple_seq_add_stmt (&seq, vstore);
 
+    /* Prevent stores into visited from being deferred.
+       asm ("" : "+m" (visited)); */
+    vec<tree, va_gc> *inputs = NULL;
+    vec<tree, va_gc> *outputs = NULL;
+#if 0 /* ... or combined in any way.  */
+    vec_safe_push (outputs,
+		   build_tree_list
+		   (build_tree_list
+		    (NULL_TREE, build_string (2, "=m")),
+		    visited));
+#endif
+    vec_safe_push (inputs,
+		   build_tree_list
+		   (build_tree_list
+		    (NULL_TREE, build_string (1, "m")),
+		    visited));
+    gasm *stabilize = gimple_build_asm_vec ("", inputs, outputs,
+					    NULL, NULL);
+    gimple_seq_add_stmt (&seq, stabilize);
+
     return seq;
   }

             reply	other threads:[~2022-10-20  5:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  5:46 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-09  8:07 Alexandre Oliva
2023-06-09  6:17 Alexandre Oliva
2023-06-08 10:59 Alexandre Oliva
2023-06-08 10:43 Alexandre Oliva
2023-06-08  9:17 Alexandre Oliva
2023-06-08  4:47 Alexandre Oliva
2022-10-25  2:52 Alexandre Oliva
2022-10-20 22:32 Alexandre Oliva
2022-10-20  4:09 Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221020054602.265CC385E03D@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).