path: root/ir/be/bepeephole.c
diff options
authorChristoph Mallon <>2015-08-02 16:07:11 +0200
committerChristoph Mallon <>2015-08-02 16:31:36 +0200
commit89688f61d70c695abba1c41ffbfdd3f692bf3eec (patch)
tree4236890c2c477f98b2516b6fab86387189a475ca /ir/be/bepeephole.c
parentf617d134f700350cd76d006b07f21643cb546f8f (diff)
arm, be, ia32, sparc: Do not go on with peephole optimization of IncSP, when be_peephole_IncSP_IncSP() succeeded.
The current IncSP was removed in this case and we now would operate on its predecessor IncSP. This is wrong, e.g. when asking for currently free registers. This corrects backend/incsp_pop.c, which was broken on ia32. It was wrongly assumed that a certain register was free and could be used to turn an IncSP into a Pop.
Diffstat (limited to 'ir/be/bepeephole.c')
1 files changed, 4 insertions, 8 deletions
diff --git a/ir/be/bepeephole.c b/ir/be/bepeephole.c
index 895444c..b90c68e 100644
--- a/ir/be/bepeephole.c
+++ b/ir/be/bepeephole.c
@@ -374,18 +374,14 @@ bool be_can_move_up(ir_heights_t *heights, const ir_node *node,
return true;
- * Tries to optimize a beIncSP node with its previous IncSP node.
- * Must be run from a be_peephole_opt() context.
- */
-ir_node *be_peephole_IncSP_IncSP(ir_node *node)
+bool be_peephole_IncSP_IncSP(ir_node *node)
ir_node *pred = be_get_IncSP_pred(node);
if (!be_is_IncSP(pred))
- return node;
+ return false;
if (!be_has_only_one_user(pred))
- return node;
+ return false;
/* add node offset to pred and remove our IncSP */
int curr_offs = be_get_IncSP_offset(node);
@@ -394,7 +390,7 @@ ir_node *be_peephole_IncSP_IncSP(ir_node *node)
be_set_IncSP_offset(pred, offs);
be_peephole_exchange(node, pred);
- return pred;
+ return true;
void be_peephole_opt(ir_graph *irg)