Hello!

The failure was caused by barrier detection code, which failed to
detect barrier after call insn was to be split when
NOTE_CALL_ARG_LOCATION was present. This problem caused
-fcompare-debug failure.

Digging a bit deeped, and as hinted in the PR, the handling of
barriers in try_split seems to be broken. The code is emitting extra
barrier for non-debug compiles, but it "forgots" to remove the
existing one, leading to duplicated barriers. The barrier is not
detected at all for debug build.

I have removed special handling of barriers here (also, the comment in
removed code was not helpful at all), and this solved -fcompare-debug
failure.

The patch was also bootstrapped and regression tested on
x86_64-linux-gnu {,-m32} which in -m32 mode splits x87 FP jump insns,
and there were no regressions. However, I am not too familiar with
rtl-optimization part and I am not confident that this code surgery is
fully correct, so this is the reason for RFC status of the patch.

2014-09-24  Uros Bizjak  <ubiz...@gmail.com>

    PR rtl-optimization/63348
    * emit-rtl.c (try_split): Do not emit extra barrier.

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Uros.
Index: emit-rtl.c
===================================================================
--- emit-rtl.c  (revision 215558)
+++ emit-rtl.c  (working copy)
@@ -3614,7 +3614,6 @@ try_split (rtx pat, rtx uncast_trial, int last)
   rtx_insn *trial = as_a <rtx_insn *> (uncast_trial);
   rtx_insn *before = PREV_INSN (trial);
   rtx_insn *after = NEXT_INSN (trial);
-  int has_barrier = 0;
   rtx note;
   rtx_insn *seq, *tem;
   int probability;
@@ -3635,14 +3634,6 @@ try_split (rtx pat, rtx uncast_trial, int last)
 
   split_branch_probability = -1;
 
-  /* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
-     We may need to handle this specially.  */
-  if (after && BARRIER_P (after))
-    {
-      has_barrier = 1;
-      after = NEXT_INSN (after);
-    }
-
   if (!seq)
     return trial;
 
@@ -3798,8 +3789,6 @@ try_split (rtx pat, rtx uncast_trial, int last)
   tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial));
 
   delete_insn (trial);
-  if (has_barrier)
-    emit_barrier_after (tem);
 
   /* Recursively call try_split for each new insn created; by the
      time control returns here that insn will be fully split, so

Reply via email to