|
|
22033d |
|
|
|
22033d |
* explow.c (anti_adjust_stack_and_probe_stack_clash): Avoid probing
|
|
|
22033d |
the red zone for stack_clash_protection_final_dynamic_probe targets
|
|
|
22033d |
when the total dynamic stack size is zero bytes.
|
|
|
22033d |
|
|
|
22033d |
diff -Nrup a/gcc/explow.c b/gcc/explow.c
|
|
|
22033d |
--- a/gcc/explow.c 2017-11-14 23:33:15.403557607 -0700
|
|
|
22033d |
+++ b/gcc/explow.c 2017-11-14 23:33:56.243239120 -0700
|
|
|
22033d |
@@ -1934,6 +1934,13 @@ anti_adjust_stack_and_probe_stack_clash
|
|
|
22033d |
if (size != CONST0_RTX (Pmode)
|
|
|
22033d |
&& targetm.stack_clash_protection_final_dynamic_probe (residual))
|
|
|
22033d |
{
|
|
|
22033d |
+ /* SIZE could be zero at runtime and in that case *sp could hold
|
|
|
22033d |
+ live data. Furthermore, we don't want to probe into the red
|
|
|
22033d |
+ zone.
|
|
|
22033d |
+
|
|
|
22033d |
+ Go ahead and just guard a probe at *sp on SIZE != 0 at runtime
|
|
|
22033d |
+ if SIZE is not a compile time constant. */
|
|
|
22033d |
+
|
|
|
22033d |
/* Ideally we would just probe at *sp. However, if SIZE is not
|
|
|
22033d |
a compile-time constant, but is zero at runtime, then *sp
|
|
|
22033d |
might hold live data. So probe at *sp if we know that
|
|
|
22033d |
@@ -1946,9 +1953,12 @@ anti_adjust_stack_and_probe_stack_clash
|
|
|
22033d |
}
|
|
|
22033d |
else
|
|
|
22033d |
{
|
|
|
22033d |
- emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
|
|
|
22033d |
- -GET_MODE_SIZE (word_mode)));
|
|
|
22033d |
+ rtx label = gen_label_rtx ();
|
|
|
22033d |
+ emit_cmp_and_jump_insns (size, CONST0_RTX (GET_MODE (size)),
|
|
|
22033d |
+ EQ, NULL_RTX, Pmode, 1, label);
|
|
|
22033d |
+ emit_stack_probe (stack_pointer_rtx);
|
|
|
22033d |
emit_insn (gen_blockage ());
|
|
|
22033d |
+ emit_label (label);
|
|
|
22033d |
}
|
|
|
22033d |
}
|
|
|
22033d |
}
|