This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[trans-mem] RFC Fix missing REG_TM notes


In trans-mem.c:make_tm_edge, it gets the slot for insertion but it doesn't set it. Fixing this makes cfgexpand.c: mark_transaction_restart_calls fails because sometimes the instruction is not found. In the attached patch, I just ignore if insn is NULL but do you have an idea why this happens?

On my side, I was able to fix the problem with genome but the patch is not clean at all and I need to find exactly where and why the problem was fixed.

Thanks!
--
Patrick Marlier.
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 183019)
+++ trans-mem.c	(working copy)
@@ -2517,6 +2517,7 @@ make_tm_edge (gimple stmt, basic_block bb, struct
     {
       n = ggc_alloc_tm_restart_node ();
       *n = dummy;
+      *slot = n;
     }
   else
     {
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 183019)
+++ cfgexpand.c	(working copy)
@@ -1978,16 +1978,22 @@ mark_transaction_restart_calls (gimple stmt)
       tree list = n->label_or_list;
       rtx insn;
 
-      for (insn = next_real_insn (get_last_insn ());
-	   !CALL_P (insn);
+      /* ??? mark only the first call, is it right? */
+      for (insn = get_last_insn ();
+	   insn && !CALL_P (insn);
 	   insn = next_real_insn (insn))
 	continue;
 
+      /* ??? insn can be NULL, why? -> some reg_note are missing. */
+      if (!insn || find_reg_note(insn, REG_TM, NULL_RTX))
+	return;
+
       if (TREE_CODE (list) == LABEL_DECL)
 	add_reg_note (insn, REG_TM, label_rtx (list));
       else
 	for (; list ; list = TREE_CHAIN (list))
 	  add_reg_note (insn, REG_TM, label_rtx (TREE_VALUE (list)));
+
     }
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]