This is the mail archive of the gcc-patches@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]

[hsa] Do not ICE when regallocating function with zero pseudoregisters


Hi,

the new HSA register allocator ICEs when it tries to resize a vector
to zero length, which is something that our vectors do not take well,
when it processes a simple function which just returns a constant and
does not actually use any registers.

Fixed thusly, committed to the hsa branch after rudimentary testing.

Thanks,

Martin


2015-02-25  Martin Jambor  <mjambor@suse.cz>

	* hsa-regalloc.c (regalloc): Bail out if there are no registers.

diff --git a/gcc/hsa-regalloc.c b/gcc/hsa-regalloc.c
index 94c88dc..8f0b4bb 100644
--- a/gcc/hsa-regalloc.c
+++ b/gcc/hsa-regalloc.c
@@ -745,6 +745,10 @@ regalloc (void)
   basic_block bb;
   reg_class_desc classes[4];
 
+  /* If there are no registers used in the function, exit right away. */
+  if (hsa_cfun.reg_count == 0)
+    return;
+
   memset (classes, 0, sizeof (classes));
   classes[0].next_avail = 0;
   classes[0].max_num = 7;


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