Commit 7412848a authored by Matthias Braun's avatar Matthias Braun
Browse files

bepeephole: check assigned entities in be_can_move_down()

This fixes a subtle bug where the delay slot filler would move a
spill/reload across a MemPerm although they both share a spillslot.
parent adccf2fb
......@@ -214,6 +214,8 @@ bool be_can_move_down(ir_heights_t *heights, const ir_node *node,
assert(get_nodes_block(node) == get_nodes_block(before));
assert(sched_get_time_step(node) < sched_get_time_step(before));
const ir_entity *const entity = arch_get_frame_entity(node);
ir_node *schedpoint = sched_next(node);
while (schedpoint != before) {
/* schedpoint must not use our computed values */
......@@ -237,6 +239,25 @@ bool be_can_move_down(ir_heights_t *heights, const ir_node *node,
/* schedpoint must not overwrite our entity... TODO: we lack a good
* API to query all entities involved with an isntruction, this is
* kinda preliminary but enough for the sparc backend. */
if (entity != NULL) {
const ir_entity *const schedpoint_entity
= arch_get_frame_entity(schedpoint);
if (schedpoint_entity == entity)
return false;
if (be_is_MemPerm(schedpoint)) {
int arity = be_get_MemPerm_entity_arity(schedpoint);
for (int i = 0; i < arity; ++i) {
if (be_get_MemPerm_out_entity(schedpoint, i) == entity)
return false;
if (be_get_MemPerm_in_entity(schedpoint, i) == entity)
return false;
schedpoint = sched_next(schedpoint);
return true;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment