aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@gmail.com>2015-07-09 03:51:21 +0000
committerJeff Law <law@gcc.gnu.org>2015-07-08 21:51:21 -0600
commitebd765d41a0a57fce59ed5fa752d6d7e22bc8eb7 (patch)
tree1a408f86caa309e452337f0f9ff65d78b1d7ca97 /gcc
parentca506be640b2b836c293450023e26ace0a0b4ea3 (diff)
downloadgcc-ebd765d41a0a57fce59ed5fa752d6d7e22bc8eb7.zip
gcc-ebd765d41a0a57fce59ed5fa752d6d7e22bc8eb7.tar.gz
gcc-ebd765d41a0a57fce59ed5fa752d6d7e22bc8eb7.tar.bz2
function.c (stack_protect_epilogue): Use if rather than switch for check targetm.have_stack_protect_test.
2015-07-08 Kito Cheng <kito.cheng@gmail.com> * function.c (stack_protect_epilogue): Use if rather than switch for check targetm.have_stack_protect_test. From-SVN: r225599
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/function.c20
2 files changed, 11 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c54e138..7747a59 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-08 Kito Cheng <kito.cheng@gmail.com>
+
+ * function.c (stack_protect_epilogue): Use if rather than switch for
+ check targetm.have_stack_protect_test.
+
2015-07-08 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* defaults.h: Provide default for WORD_REGISTER_OPERATIONS.
diff --git a/gcc/function.c b/gcc/function.c
index 972cdc8..b87aef6 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4874,26 +4874,18 @@ stack_protect_epilogue (void)
tree guard_decl = targetm.stack_protect_guard ();
rtx_code_label *label = gen_label_rtx ();
rtx x, y, tmp;
+ rtx_insn *seq;
x = expand_normal (crtl->stack_protect_guard);
y = expand_normal (guard_decl);
/* Allow the target to compare Y with X without leaking either into
a register. */
- switch (targetm.have_stack_protect_test ())
- {
- case 1:
- if (rtx_insn *seq = targetm.gen_stack_protect_test (x, y, label))
- {
- emit_insn (seq);
- break;
- }
- /* FALLTHRU */
-
- default:
- emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
- break;
- }
+ if (targetm.have_stack_protect_test ()
+ && ((seq = targetm.gen_stack_protect_test (x, y, label)) != NULL_RTX))
+ emit_insn (seq);
+ else
+ emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
/* The noreturn predictor has been moved to the tree level. The rtl-level
predictors estimate this branch about 20%, which isn't enough to get