[commit, spu] Fix regression (Re: [PR debug/47590] rework md option overriding to delay var-tracking)

Ulrich Weigand uweigand@de.ibm.com
Wed Jul 13 19:33:00 GMT 2011


Alexandre Oliva wrote:

> 	* config/spu/spu.c (spu_flag_var_tracking): Drop.
> 	(TARGET_DELAY_VARTRACK): Define.
> 	(spu_var_tracking): New.
> 	(spu_machine_dependent_reorg): Call it.
> 	(asm_file_start): Don't save and override flag_var_tracking.

This change caused crashes under certain circumstances.  The problem
is that spu_var_tracking calls df_analyze, which assumes the df
framework has been keeping up to date on instructions.  In particular,
it assumes that df_scan_insn was called for each insn that was
generated in the meantime.  Normally, this is not a problem, because
the emit_insn family itself calls df_scan_insn.

However, this works only as long as the assignment of insns to basic
blocks is valid.  In machine-dependent reorg, this is no longer true.
To fix this, the current place in spu_machine_dependent_reorg that
used to call df_analyze made sure to re-install the basic-block
mappings by calling compute_bb_for_insn before.

The new location where your patch has added a call to df_analyze,
however, is out of the scope of that existing compute_bb_for_insn
call, causing those problems.

Fixed by adding another compute_bb_for_insn/free_bb_for_insn pair
to cover the new call site as well.

Also, asm_file_start now no longer does anything interesting,
and can just be removed in favor of the default implementation.

Tested on spu-elf, committed to mainline.

Bye,
Ulrich


ChangeLog:

	* config/spu/spu.c (TARGET_ASM_FILE_START): Do not define.
	(asm_file_start): Remove.
	(spu_machine_dependent_reorg): Call compute_bb_for_insn and
	free_bb_for_insn around code that modifies insns before
	restarting df analysis.

Index: gcc/config/spu/spu.c
===================================================================
*** gcc/config/spu/spu.c	(revision 176209)
--- gcc/config/spu/spu.c	(working copy)
*************** static enum machine_mode spu_addr_space_
*** 224,230 ****
  static bool spu_addr_space_subset_p (addr_space_t, addr_space_t);
  static rtx spu_addr_space_convert (rtx, tree, tree);
  static int spu_sms_res_mii (struct ddg *g);
- static void asm_file_start (void);
  static unsigned int spu_section_type_flags (tree, const char *, int);
  static section *spu_select_section (tree, int, unsigned HOST_WIDE_INT);
  static void spu_unique_section (tree, int);
--- 224,229 ----
*************** static void spu_setup_incoming_varargs (
*** 462,470 ****
  #undef TARGET_SCHED_SMS_RES_MII
  #define TARGET_SCHED_SMS_RES_MII spu_sms_res_mii
  
- #undef TARGET_ASM_FILE_START
- #define TARGET_ASM_FILE_START asm_file_start
- 
  #undef TARGET_SECTION_TYPE_FLAGS
  #define TARGET_SECTION_TYPE_FLAGS spu_section_type_flags
  
--- 461,466 ----
*************** spu_machine_dependent_reorg (void)
*** 2703,2711 ****
--- 2699,2709 ----
      {
        /* We still do it for unoptimized code because an external
           function might have hinted a call or return. */
+       compute_bb_for_insn ();
        insert_hbrp ();
        pad_bb ();
        spu_var_tracking ();
+       free_bb_for_insn ();
        return;
      }
  
*************** spu_libgcc_shift_count_mode (void)
*** 7039,7052 ****
    return SImode;
  }
  
- /* An early place to adjust some flags after GCC has finished processing
-  * them. */
- static void
- asm_file_start (void)
- {
-   default_file_start ();
- }
- 
  /* Implement targetm.section_type_flags.  */
  static unsigned int
  spu_section_type_flags (tree decl, const char *name, int reloc)
--- 7037,7042 ----


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com



More information about the Gcc-patches mailing list