diff mbox

[hsa] Avoid setting register definitions when adding operands to a phi node

Message ID 20150909133436.GG21293@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Sept. 9, 2015, 1:34 p.m. UTC
Hi,

with the new operand setter method, we've been attempting to set
definition of a register when we were adding it to the zeroth operand
of a phi node.  Fortunately, there is an assert to detect the
situation.  Fixed thusly, will commit to the branch after rudimentary
testing.

Thanks,

Martin


2015-09-09  Martin Jambor  <mjambor@suse.cz>

	* hsa.c (hsa_opcode_op_output_p): Handle HSA_OPCODE_PHI, change
	type of the opcode argument to int.
	* hsa.h (hsa_opcode_op_output_p): Change declaration accordingly.
diff mbox

Patch

diff --git a/gcc/hsa.c b/gcc/hsa.c
index 017b4ca..2dac448 100644
--- a/gcc/hsa.c
+++ b/gcc/hsa.c
@@ -158,14 +158,15 @@  hsa_full_profile_p (void)
   return true;
 }
 
-/* Return true if operand number OPNUM of instruction with OPCODE is an output.
-   False if it is an input.  */
+/* Return true if a register in operand number OPNUM of instruction with OPCODE
+   is output of that instruction.  False if it is an input.  */
 
 bool
-hsa_opcode_op_output_p (BrigOpcode16_t opcode, int opnum)
+hsa_opcode_op_output_p (int opcode, int opnum)
 {
   switch (opcode)
     {
+    case HSA_OPCODE_PHI:
     case BRIG_OPCODE_CBR:
     case BRIG_OPCODE_ST:
       /* FIXME: There are probably missing cases here, double check.  */
diff --git a/gcc/hsa.h b/gcc/hsa.h
index e687672..19d19da 100644
--- a/gcc/hsa.h
+++ b/gcc/hsa.h
@@ -984,7 +984,7 @@  void hsa_init_compilation_unit_data (void);
 void hsa_deinit_compilation_unit_data (void);
 bool hsa_machine_large_p (void);
 bool hsa_full_profile_p (void);
-bool hsa_opcode_op_output_p (BrigOpcode16_t, int);
+bool hsa_opcode_op_output_p (int, int);
 unsigned hsa_type_bit_size (BrigType16_t t);
 BrigType16_t hsa_bittype_for_type (BrigType16_t t);
 bool hsa_type_float_p (BrigType16_t type);