/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
- *
* This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
*/
/**
*/
static void fix_flags_walker(ir_node *block, void *env)
{
- ir_node *node;
ir_node *flags_needed = NULL;
ir_node *flag_consumers = NULL;
int pn = -1;
(void) env;
+ ir_node *place = block;
sched_foreach_reverse(block, node) {
int i, arity;
ir_node *new_flags_needed = NULL;
ir_node *test;
- if (is_Phi(node))
+ if (is_Phi(node)) {
+ place = node;
break;
+ }
if (node == flags_needed) {
/* all ok */
if (flags_needed != NULL) {
assert(get_nodes_block(flags_needed) != block);
- rematerialize_or_move(flags_needed, node, flag_consumers, pn);
+ rematerialize_or_move(flags_needed, place, flag_consumers, pn);
flags_needed = NULL;
flag_consumers = NULL;
}