From dddc18157283e3ab2a3a4c32ededae2386a54bb3 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Tue, 13 Nov 2018 13:51:30 +0100 Subject: [PATCH] [ARC] Do not emit ZOL in the presence of text jump tables. Avoid emitting lp instruction when in its ZOL body we find a jump table data in text section. One of the reason is the jump tables size can be changed latter on, hence the total ZOL length may be wrongly computed. gcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/arc.c (hwloop_optimize): Bailout when detecting a jump table data in the text section. From-SVN: r266067 --- gcc/ChangeLog | 5 +++++ gcc/config/arc/arc.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5683289a8d8..7ba3fd3f359 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-11-13 Claudiu Zissulescu + + * config/arc/arc.c (hwloop_optimize): Bailout when detecting a + jump table data in the text section. + 2018-11-13 Claudiu Zissulescu * config/arc/arc.c (arc_eh_return_address_location): Repurpose it diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index dbe6ff51637..6bf8e852235 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -7861,7 +7861,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.30.2