aboutsummaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorYuri Rumyantsev <ysrumyan@gmail.com>2016-01-11 12:07:31 +0000
committerIlya Enkovich <ienkovich@gcc.gnu.org>2016-01-11 12:07:31 +0000
commitca90b1ed9ac7e9aaacb3ef0eb055d2f594d30493 (patch)
treeaff7cf99fbd76cee5e9f06139145d6518bc63045 /gcc/ifcvt.c
parentb4934671aed067e0a8c3ac3fcc5871dd27a706ed (diff)
downloadgcc-ca90b1ed9ac7e9aaacb3ef0eb055d2f594d30493.zip
gcc-ca90b1ed9ac7e9aaacb3ef0eb055d2f594d30493.tar.gz
gcc-ca90b1ed9ac7e9aaacb3ef0eb055d2f594d30493.tar.bz2
re PR rtl-optimization/68920 (Undesirable if-conversion for a rarely taken branch)
gcc/ 2016-01-11 Yuri Rumyantsev <ysrumyan@gmail.com> PR rtl-optimization/68920 * config/i386/i386.c (ix86_option_override_internal): Restrict number of conditional moves for RTL if-conversion to 1 for TARGET_ONE_IF_CONV_INSN. * config/i386/i386.h (TARGET_ONE_IF_CONV_INSN): New macros. * config/i386/x86-tune.def (X86_TUNE_ONE_IF_CONV_INSN): New macros. * params.def (PARAM_MAX_RTL_IF_CONVERSION_INSNS) : Introduce new parameter to restirct number of conditional moves for RTL if-conversion. * doc/invoke.texi (max-rtl-if-conversion-insns): Document it. * ifcvt.c (bb_ok_for_noce_convert_multiple_sets): Limit number of conditionl moves. gcc/testsuite/ 2016-01-11 Yuri Rumyantsev <ysrumyan@gmail.com> PR rtl-optimization/68920 * gcc.dg/ifcvt-4.c: Add "--param max-rtl-if-conversion-insns=3" option for ix86 targets. * gcc.dg/ifcvt-5.c: New test. From-SVN: r232220
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 67b10cf..723ea3e 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -44,6 +44,7 @@
#include "shrink-wrap.h"
#include "rtl-iter.h"
#include "ifcvt.h"
+#include "params.h"
#ifndef MAX_CONDITIONAL_EXECUTE
#define MAX_CONDITIONAL_EXECUTE \
@@ -3242,6 +3243,8 @@ bb_ok_for_noce_convert_multiple_sets (basic_block test_bb,
{
rtx_insn *insn;
unsigned count = 0;
+ unsigned param = PARAM_VALUE (PARAM_MAX_RTL_IF_CONVERSION_INSNS);
+ unsigned limit = MIN (ii->branch_cost, param);
FOR_BB_INSNS (test_bb, insn)
{
@@ -3277,8 +3280,8 @@ bb_ok_for_noce_convert_multiple_sets (basic_block test_bb,
/* FORNOW: Our cost model is a count of the number of instructions we
would if-convert. This is suboptimal, and should be improved as part
of a wider rework of branch_cost. */
- if (count > ii->branch_cost)
- return FALSE;
+ if (count > limit)
+ return false;
return count > 0;
}
@@ -3823,7 +3826,6 @@ cond_move_process_if_block (struct noce_if_info *if_info)
}
num_updated_if_blocks++;
-
success_p = TRUE;
done:
@@ -4810,7 +4812,6 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
num_true_changes++;
num_updated_if_blocks++;
-
return TRUE;
}