diff mbox

[3/3] PR jit/64810: fix for arm_option_override

Message ID 1422616301-38365-1-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Jan. 30, 2015, 11:11 a.m. UTC
libgccjit can make repeated in-process calls to the compiler code.

On arm I see failures where e.g. the top of the generated .s file has:
on the 1st iteration:
  .arch armv7-a
on the 2nd iteration:
  .cpu armv7-a
without changing any options.

What's happening is the 1st time through arm_option_override,
arm_selected_cpu is NULL, but is set to non-NULL at:
  arm_selected_cpu = arm_selected_arch;
The 2nd time through, arm_selected_cpu hasn't been reset, and so the
condition:

  if (arm_selected_arch)
    {
      if (arm_selected_cpu)
	{
	  /* Check for conflict between mcpu and march.  */

fires, and this clause fires:

	    /* -mcpu wins.  */
	    arm_selected_arch = NULL;

so we have a NULL arm_selected_arch and a non-NULL arm_selected_cpu.

The fix is to reset arm-specific state, setting
  arm_selected_{arch|cpu|tune}
to NULL at the top of arm_option_override, to prevent state from
previous in-process runs from affecting things.

With this, and the previous patches, most of the jit testsuite passes
on arm, with the only remaining failures being of the form:
  WARNING: Timed out executing test case
on the very large test cases (test-combination.c and test-threads.c).

OK for stage 4?

gcc/ChangeLog:
	PR jit/64810
	* config/arm/arm.c (arm_option_override): Set
	arm_selected_arch/cpu/tune to NULL on entry.
---
 gcc/config/arm/arm.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Richard Earnshaw Jan. 30, 2015, 11:21 a.m. UTC | #1
On 30/01/15 11:11, David Malcolm wrote:
> libgccjit can make repeated in-process calls to the compiler code.
> 
> On arm I see failures where e.g. the top of the generated .s file has:
> on the 1st iteration:
>   .arch armv7-a
> on the 2nd iteration:
>   .cpu armv7-a
> without changing any options.
> 
> What's happening is the 1st time through arm_option_override,
> arm_selected_cpu is NULL, but is set to non-NULL at:
>   arm_selected_cpu = arm_selected_arch;
> The 2nd time through, arm_selected_cpu hasn't been reset, and so the
> condition:
> 
>   if (arm_selected_arch)
>     {
>       if (arm_selected_cpu)
> 	{
> 	  /* Check for conflict between mcpu and march.  */
> 
> fires, and this clause fires:
> 
> 	    /* -mcpu wins.  */
> 	    arm_selected_arch = NULL;
> 
> so we have a NULL arm_selected_arch and a non-NULL arm_selected_cpu.
> 
> The fix is to reset arm-specific state, setting
>   arm_selected_{arch|cpu|tune}
> to NULL at the top of arm_option_override, to prevent state from
> previous in-process runs from affecting things.
> 
> With this, and the previous patches, most of the jit testsuite passes
> on arm, with the only remaining failures being of the form:
>   WARNING: Timed out executing test case
> on the very large test cases (test-combination.c and test-threads.c).
> 
> OK for stage 4?
> 
> gcc/ChangeLog:
> 	PR jit/64810
> 	* config/arm/arm.c (arm_option_override): Set
> 	arm_selected_arch/cpu/tune to NULL on entry.

OK.

R.

> ---
>  gcc/config/arm/arm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 246298a..c7c0ecf 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -2627,6 +2627,10 @@ arm_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
>  static void
>  arm_option_override (void)
>  {
> +  arm_selected_arch = NULL;
> +  arm_selected_cpu = NULL;
> +  arm_selected_tune = NULL;
> +
>    if (global_options_set.x_arm_arch_option)
>      arm_selected_arch = &all_architectures[arm_arch_option];
>  
>
diff mbox

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 246298a..c7c0ecf 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2627,6 +2627,10 @@  arm_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
 static void
 arm_option_override (void)
 {
+  arm_selected_arch = NULL;
+  arm_selected_cpu = NULL;
+  arm_selected_tune = NULL;
+
   if (global_options_set.x_arm_arch_option)
     arm_selected_arch = &all_architectures[arm_arch_option];