Re: [google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Teresa Johnson
Yes, this needs to be fixed on trunk too. I looked at the history and
it has been this way (overwriting the footer) for years. It must be
uncommon to have this confluence of events.

Thanks,
Teresa

On Fri, Oct 3, 2014 at 9:28 AM, Xinliang David Li  wrote:
> This patch should be targeting trunk gcc?
>
> David
>
> On Fri, Oct 3, 2014 at 9:23 AM, Rong Xu  wrote:
>> Hi,
>>
>> This patch fixed a bug exposed in build kernel with fdo.
>>
>> We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
>> the bb may already have a footer (in this case, a deleted label stmt).
>> We need to output this label because it's a user label and debug_info
>> has a reference to it.
>>
>> Tested with problematic file and regression test.
>> Trunk may also have the same issue, but I need to work on a testcase.
>>
>> Thanks,
>>
>> -Rong



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Xinliang David Li
This patch should be targeting trunk gcc?

David

On Fri, Oct 3, 2014 at 9:23 AM, Rong Xu  wrote:
> Hi,
>
> This patch fixed a bug exposed in build kernel with fdo.
>
> We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
> the bb may already have a footer (in this case, a deleted label stmt).
> We need to output this label because it's a user label and debug_info
> has a reference to it.
>
> Tested with problematic file and regression test.
> Trunk may also have the same issue, but I need to work on a testcase.
>
> Thanks,
>
> -Rong


[google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Rong Xu
Hi,

This patch fixed a bug exposed in build kernel with fdo.

We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
the bb may already have a footer (in this case, a deleted label stmt).
We need to output this label because it's a user label and debug_info
has a reference to it.

Tested with problematic file and regression test.
Trunk may also have the same issue, but I need to work on a testcase.

Thanks,

-Rong
2014-10-02  Rong Xu  

* gcc/cfgrtl.c (emit_barrier_after_bb): Append footer instead of
overwriting.

Index: gcc/cfgrtl.c
===
--- gcc/cfgrtl.c(revision 215823)
+++ gcc/cfgrtl.c(working copy)
@@ -1453,7 +1453,20 @@ emit_barrier_after_bb (basic_block bb)
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
   || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
-BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+{
+  rtx insn = unlink_insn_chain (barrier, barrier);
+
+  if (BB_FOOTER (bb))
+   {
+  rtx footer_tail = BB_FOOTER (bb);
+  while (NEXT_INSN(footer_tail))
+footer_tail = NEXT_INSN (insn);
+ NEXT_INSN (footer_tail) = insn;
+ PREV_INSN (insn) = footer_tail;
+   }
+  else
+BB_FOOTER (bb) = insn;
+}
 }
 
 /* Like force_nonfallthru below, but additionally performs redirection