aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-12-01 00:26:41 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-12-01 00:26:41 +0100
commite26584b265dc2af4e95d23c4bdd89462ea508b69 (patch)
tree3f6973695d8e1b6e54221177085dd8ab887441d1 /gcc/fold-const.c
parent2b86de4cc6bf812ecdd343dd426da8497a93d479 (diff)
downloadgcc-e26584b265dc2af4e95d23c4bdd89462ea508b69.zip
gcc-e26584b265dc2af4e95d23c4bdd89462ea508b69.tar.gz
gcc-e26584b265dc2af4e95d23c4bdd89462ea508b69.tar.bz2
re PR testsuite/85368 (phi-opt-11 test fails on IBM Z)
PR testsuite/85368 * params.def (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT): New param. * tree-ssa-ifcombine.c (ifcombine_ifandif): If --param logical-op-non-short-circuit is present, override LOGICAL_OP_NON_SHORT_CIRCUIT value from the param. * fold-const.c (fold_range_test, fold_truth_andor): Likewise. * lib/target-supports.exp (logical_op_short_circuit): Remove. * gcc.dg/builtin-bswap-7.c: Remove logical_op_short_circuit effective target, drop -mbranch-cost= options from the test and instead pass --param logical-op-non-short-circuit=0 or --param logical-op-non-short-circuit=1 depending on what the tests meant to test. * gcc.dg/pr21643.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise. * gcc.dg/tree-ssa/phi-opt-11.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-4.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-thread-14.c: Likewise. * gcc.dg/tree-ssa/vrp47.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-11.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-16.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise. * gcc.dg/tree-ssa/vrp87.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise. * gcc.dg/tree-ssa/phi-opt-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-13.c: Likewise. * gcc.dg/tree-ssa/ssa-thread-11.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise. * gcc.dg/tree-ssa/forwprop-28.c: Likewise. * gcc.dg/binop-xor1.c: Likewise. * gcc.dg/pr46309.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-18.c: New test. * gcc.dg/tree-ssa/reassoc-32.c: Add --param logical-op-non-short-circuit=1 to dg-options. * gcc.dg/tree-ssa/reassoc-33.c: Likewise. * gcc.dg/tree-ssa/reassoc-34.c: Likewise. * gcc.dg/tree-ssa/reassoc-35.c: Likewise. * gcc.dg/tree-ssa/reassoc-36.c: Likewise. From-SVN: r266700
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 5399288..45de94c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5572,12 +5572,15 @@ fold_range_test (location_t loc, enum tree_code code, tree type,
/* On machines where the branch cost is expensive, if this is a
short-circuited branch and the underlying object on both sides
is the same, make a non-short-circuit operation. */
- else if (LOGICAL_OP_NON_SHORT_CIRCUIT
- && !flag_sanitize_coverage
- && lhs != 0 && rhs != 0
- && (code == TRUTH_ANDIF_EXPR
- || code == TRUTH_ORIF_EXPR)
- && operand_equal_p (lhs, rhs, 0))
+ bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT;
+ if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1)
+ logical_op_non_short_circuit
+ = PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT);
+ if (logical_op_non_short_circuit
+ && !flag_sanitize_coverage
+ && lhs != 0 && rhs != 0
+ && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
+ && operand_equal_p (lhs, rhs, 0))
{
/* If simple enough, just rewrite. Otherwise, make a SAVE_EXPR
unless we are at top level or LHS contains a PLACEHOLDER_EXPR, in
@@ -8229,7 +8232,11 @@ fold_truth_andor (location_t loc, enum tree_code code, tree type,
if ((tem = fold_truth_andor_1 (loc, code, type, arg0, arg1)) != 0)
return tem;
- if (LOGICAL_OP_NON_SHORT_CIRCUIT
+ bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT;
+ if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1)
+ logical_op_non_short_circuit
+ = PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT);
+ if (logical_op_non_short_circuit
&& !flag_sanitize_coverage
&& (code == TRUTH_AND_EXPR
|| code == TRUTH_ANDIF_EXPR