diff options
author | Sudakshina Das <sudi.das@arm.com> | 2018-03-22 17:24:41 +0000 |
---|---|---|
committer | Sudakshina Das <sudi@gcc.gnu.org> | 2018-03-22 17:24:41 +0000 |
commit | bb4ac03b8ffda26d3b1d55d433b777509dbc5e4c (patch) | |
tree | adaaf81bbf737cd7ad08fc0dd9c5425ba529deb9 | |
parent | 253db5538bfa249acd24d3aa30a3e28bcf8046d1 (diff) | |
download | gcc-bb4ac03b8ffda26d3b1d55d433b777509dbc5e4c.zip gcc-bb4ac03b8ffda26d3b1d55d433b777509dbc5e4c.tar.gz gcc-bb4ac03b8ffda26d3b1d55d433b777509dbc5e4c.tar.bz2 |
[ARM][PR target/84826] Fix ICE in extract_insn, at recog.c:2304 on
arm-linux-gnueabi
The ICE in the bug report was happening because the macro
USE_RETURN_INSN (FALSE) was returning different values at different points
in the compilation. This was internally occurring because the function
arm_compute_static_chain_stack_bytes () which was dependent on
arm_r3_live_at_start_p () was giving a different value after the cond_exec
instructions were created in ce3 causing the liveness of r3 to escape up
to the start block.
The function arm_compute_static_chain_stack_bytes () should really only
compute the value once duringepilogue/prologue stage. This pass introduces
a new member 'static_chain_stack_bytes' to the target definition of the
struct machine_function which gets calculated in expand_prologue and is the
value that is returned by arm_compute_static_chain_stack_bytes () beyond that.
ChangeLog entries:
*** gcc/ChangeLog ***
2018-03-22 Sudakshina Das <sudi.das@arm.com>
PR target/84826
* config/arm/arm.h (machine_function): Add static_chain_stack_bytes.
* config/arm/arm.c (arm_compute_static_chain_stack_bytes): Avoid
re-computing once computed.
(arm_expand_prologue): Compute machine->static_chain_stack_bytes.
(arm_init_machine_status): Initialize
machine->static_chain_stack_bytes.
*** gcc/testsuite/ChangeLog ***
2018-03-22 Sudakshina Das <sudi.das@arm.com>
PR target/84826
* gcc.target/arm/pr84826.c: New test.
From-SVN: r258777
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 11 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/pr84826.c | 15 |
5 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01f109a..57bb60a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-03-22 Sudakshina Das <sudi.das@arm.com> + + PR target/84826 + * config/arm/arm.h (machine_function): Add static_chain_stack_bytes. + * config/arm/arm.c (arm_compute_static_chain_stack_bytes): Avoid + re-computing once computed. + (arm_expand_prologue): Compute machine->static_chain_stack_bytes. + (arm_init_machine_status): Initialize + machine->static_chain_stack_bytes. + 2018-03-22 Kelvin Nilsen <kelvin@gcc.gnu.org> PR target/84760 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index cb6ab81..b981956 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -19392,6 +19392,11 @@ arm_r3_live_at_start_p (void) static int arm_compute_static_chain_stack_bytes (void) { + /* Once the value is updated from the init value of -1, do not + re-compute. */ + if (cfun->machine->static_chain_stack_bytes != -1) + return cfun->machine->static_chain_stack_bytes; + /* See the defining assertion in arm_expand_prologue. */ if (IS_NESTED (arm_current_func_type ()) && ((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM) @@ -21699,6 +21704,11 @@ arm_expand_prologue (void) emit_insn (gen_movsi (stack_pointer_rtx, r1)); } + /* Let's compute the static_chain_stack_bytes required and store it. Right + now the value must be -1 as stored by arm_init_machine_status (). */ + cfun->machine->static_chain_stack_bytes + = arm_compute_static_chain_stack_bytes (); + /* The static chain register is the same as the IP register. If it is clobbered when creating the frame, we need to save and restore it. */ clobber_ip = IS_NESTED (func_type) @@ -24875,6 +24885,7 @@ arm_init_machine_status (void) #if ARM_FT_UNKNOWN != 0 machine->func_type = ARM_FT_UNKNOWN; #endif + machine->static_chain_stack_bytes = -1; return machine; } diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index bbf3937..2809112 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1384,6 +1384,9 @@ typedef struct GTY(()) machine_function machine_mode thumb1_cc_mode; /* Set to 1 after arm_reorg has started. */ int after_arm_reorg; + /* The number of bytes used to store the static chain register on the + stack, above the stack frame. */ + int static_chain_stack_bytes; } machine_function; #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20336c0..d1ddb79 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-22 Sudakshina Das <sudi.das@arm.com> + + PR target/84826 + * gcc.target/arm/pr84826.c: New test. + 2018-03-22 Christophe Lyon <christophe.lyon@linaro.org> * gcc.target/arm/addr-modes-float.c: Move dg-do before diff --git a/gcc/testsuite/gcc.target/arm/pr84826.c b/gcc/testsuite/gcc.target/arm/pr84826.c new file mode 100644 index 0000000..c61c548 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr84826.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -fstack-clash-protection" } */ + +void d (void *); + +void a () +{ + int b; + void bar (int c) + { + if (__builtin_expect (c, 0)) + ++b; + } + d (bar); +} |