/** Enable Alias-analysis. */
I_FLAG(alias_analysis , 28, ON)
+/** This flag is set while the reassociation optimizations are running */
+I_FLAG(reassoc_running , 29, OFF)
+
/** This flag is set while architecture dependent optimizations are running */
-I_FLAG(arch_dep_running , 29, OFF)
+I_FLAG(arch_dep_running , 30, OFF)
/** Closed world assumption. */
I_FLAG(closed_world , 31, OFF)
DBG_OPT_ALGSIM0(oldn, n, FS_OPT_ADD_A_MINUS_B);
return n;
}
- if (! get_opt_reassociation()) {
+ if (! get_opt_reassoc_running()) {
/* do NOT execute this code if reassociation is enabled, it does the inverse! */
if (is_Mul(a)) {
ir_node *ma = get_Mul_left(a);
}
}
/* do NOT execute this code if reassociation is enabled, it does the inverse! */
- if (get_opt_reassociation() && is_Mul(a)) {
+ if (get_opt_reassoc_running() && is_Mul(a)) {
ir_node *ma = get_Mul_left(a);
ir_node *mb = get_Mul_right(a);
env.changes = 0;
env.wq = new_waitq();
- /* now we have collected enough information, optimize */
- irg_walk_graph(irg, NULL, wq_walker, &env);
- do_reassociation(&env);
-
- /* reverse those rules that do not result in collapsed constants */
- irg_walk_graph(irg, NULL, reverse_rules, &env);
+ /* disable some optimizations while reassoc is running to prevent endless loops */
+ set_opt_reassoc_running(1);
+ {
+ /* now we have collected enough information, optimize */
+ irg_walk_graph(irg, NULL, wq_walker, &env);
+ do_reassociation(&env);
+
+ /* reverse those rules that do not result in collapsed constants */
+ irg_walk_graph(irg, NULL, reverse_rules, &env);
+ }
+ set_opt_reassoc_running(0);
/* Handle graph state */
if (env.changes) {