diff mbox series

[2/3,ARC] Do not emit ZOL in the presence of text jump tables.

Message ID 20181112112513.4369-3-claziss@gmail.com
State New
Headers show
Series Glibc required patches | expand

Commit Message

Claudiu Zissulescu Ianculescu Nov. 12, 2018, 11:25 a.m. UTC
Avoid emitting lp instruction when in its ZOL body we find a jump table data
in text section.

gcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (hwloop_optimize): Bailout when detecting a
	jump table data in the text section.
---
 gcc/config/arc/arc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Andrew Burgess Nov. 13, 2018, 10:25 a.m. UTC | #1
* Claudiu Zissulescu <claziss@gmail.com> [2018-11-12 13:25:12 +0200]:

> Avoid emitting lp instruction when in its ZOL body we find a jump table data
> in text section.
> 
> gcc/
> xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* config/arc/arc.c (hwloop_optimize): Bailout when detecting a
> 	jump table data in the text section.

This looks good from a code point of view, but there's no explanation
for _why_ this change was made.... might be worth mentioning.

Thanks,
Andrew



> ---
>  gcc/config/arc/arc.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index a92456b457d..9eab4c27284 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -7791,7 +7791,17 @@ hwloop_optimize (hwloop_info loop)
>    for (insn = loop->start_label;
>         insn && insn != loop->loop_end;
>         insn = NEXT_INSN (insn))
> -    length += NONDEBUG_INSN_P (insn) ? get_attr_length (insn) : 0;
> +    {
> +      length += NONDEBUG_INSN_P (insn) ? get_attr_length (insn) : 0;
> +      if (JUMP_TABLES_IN_TEXT_SECTION
> +	  && JUMP_TABLE_DATA_P (insn))
> +	{
> +	  if (dump_file)
> +	    fprintf (dump_file, ";; loop %d has a jump table\n",
> +		     loop->loop_no);
> +	  return false;
> +	}
> +    }
>  
>    if (!insn)
>      {
> -- 
> 2.19.1
>
diff mbox series

Patch

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index a92456b457d..9eab4c27284 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -7791,7 +7791,17 @@  hwloop_optimize (hwloop_info loop)
   for (insn = loop->start_label;
        insn && insn != loop->loop_end;
        insn = NEXT_INSN (insn))
-    length += NONDEBUG_INSN_P (insn) ? get_attr_length (insn) : 0;
+    {
+      length += NONDEBUG_INSN_P (insn) ? get_attr_length (insn) : 0;
+      if (JUMP_TABLES_IN_TEXT_SECTION
+	  && JUMP_TABLE_DATA_P (insn))
+	{
+	  if (dump_file)
+	    fprintf (dump_file, ";; loop %d has a jump table\n",
+		     loop->loop_no);
+	  return false;
+	}
+    }
 
   if (!insn)
     {