aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/passes.def4
-rw-r--r--gcc/tree-ssa-reassoc.c28
3 files changed, 36 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e6e4fbe..91bfc8c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,17 @@
2015-11-16 Tom de Vries <tom@codesourcery.com>
+ * passes.def: Add arg to pass_reassoc pass instantiation.
+ * tree-ssa-reassoc.c (reassoc_insert_powi_p): New static variable.
+ (acceptable_pow_call, reassociate_bb): Use reassoc_insert_powi_p instead
+ of first_pass_instance.
+ (execute_reassoc): Add and handle insert_powi_p parameter.
+ (pass_reassoc::insert_powi_p): New private member.
+ (pass_reassoc::pass_reassoc): Initialize insert_powi_p.
+ (pass_reassoc::set_pass_param): New member function. Set insert_powi_p.
+ (pass_reassoc::execute): Call execute_reassoc with extra arg.
+
+2015-11-16 Tom de Vries <tom@codesourcery.com>
+
* gdbhooks.py (class PassNames): Handle extra arg NEXT_PASS argument.
* gen-pass-instances.awk (handle_line): Same.
* pass_manager.h (class pass_manager): Define and undefine
diff --git a/gcc/passes.def b/gcc/passes.def
index 64c1fa1..78fdf0f 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -205,7 +205,7 @@ along with GCC; see the file COPYING3. If not see
opportunities. */
NEXT_PASS (pass_phi_only_cprop);
NEXT_PASS (pass_dse);
- NEXT_PASS (pass_reassoc);
+ NEXT_PASS (pass_reassoc, true /* insert_powi_p */);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt);
@@ -276,7 +276,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_lower_vector_ssa);
NEXT_PASS (pass_split_paths);
NEXT_PASS (pass_cse_reciprocals);
- NEXT_PASS (pass_reassoc);
+ NEXT_PASS (pass_reassoc, false /* insert_powi_p */);
NEXT_PASS (pass_strength_reduction);
NEXT_PASS (pass_tracer);
NEXT_PASS (pass_dominator);
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index a75290c..6b08a59 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -172,6 +172,9 @@ along with GCC; see the file COPYING3. If not see
destructive update for the associating op, and keep the destructive
update together for vector sum reduction recognition. */
+/* Enable insertion of __builtin_powi calls during execute_reassoc. See
+ point 3a in the pass header comment. */
+static bool reassoc_insert_powi_p;
/* Statistics */
static struct
@@ -3940,7 +3943,7 @@ acceptable_pow_call (gimple *stmt, tree *base, HOST_WIDE_INT *exponent)
tree fndecl, arg1;
REAL_VALUE_TYPE c, cint;
- if (!first_pass_instance
+ if (!reassoc_insert_powi_p
|| !flag_unsafe_math_optimizations
|| !is_gimple_call (stmt)
|| !has_single_use (gimple_call_lhs (stmt)))
@@ -4856,7 +4859,7 @@ reassociate_bb (basic_block bb)
if (rhs_code == MULT_EXPR)
attempt_builtin_copysign (&ops);
- if (first_pass_instance
+ if (reassoc_insert_powi_p
&& rhs_code == MULT_EXPR
&& flag_unsafe_math_optimizations)
powi_result = attempt_builtin_powi (stmt, &ops);
@@ -5111,11 +5114,14 @@ fini_reassoc (void)
loop_optimizer_finalize ();
}
-/* Gate and execute functions for Reassociation. */
+/* Gate and execute functions for Reassociation. If INSERT_POWI_P, enable
+ insertion of __builtin_powi calls. */
static unsigned int
-execute_reassoc (void)
+execute_reassoc (bool insert_powi_p)
{
+ reassoc_insert_powi_p = insert_powi_p;
+
init_reassoc ();
do_reassoc ();
@@ -5145,14 +5151,24 @@ class pass_reassoc : public gimple_opt_pass
{
public:
pass_reassoc (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_reassoc, ctxt)
+ : gimple_opt_pass (pass_data_reassoc, ctxt), insert_powi_p (false)
{}
/* opt_pass methods: */
opt_pass * clone () { return new pass_reassoc (m_ctxt); }
+ void set_pass_param (unsigned int n, bool param)
+ {
+ gcc_assert (n == 0);
+ insert_powi_p = param;
+ }
virtual bool gate (function *) { return flag_tree_reassoc != 0; }
- virtual unsigned int execute (function *) { return execute_reassoc (); }
+ virtual unsigned int execute (function *)
+ { return execute_reassoc (insert_powi_p); }
+ private:
+ /* Enable insertion of __builtin_powi calls during execute_reassoc. See
+ point 3a in the pass header comment. */
+ bool insert_powi_p;
}; // class pass_reassoc
} // anon namespace