+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.
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);
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);
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
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)))
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);
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 ();
{
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