only set target equal to src->source in MoveEvent.compile if it is a simple load or store

This commit is contained in:
Joel Dice 2008-05-19 07:44:39 -06:00
parent ad6153612b
commit 08a1921eb7

View File

@ -1500,6 +1500,9 @@ class MoveEvent: public Event {
fprintf(stderr, "MoveEvent.compile\n"); fprintf(stderr, "MoveEvent.compile\n");
} }
bool isLoad = src->reads->next == 0;
bool isStore = dst->reads == 0;
Site* target; Site* target;
unsigned cost; unsigned cost;
if (type == Move if (type == Move
@ -1512,7 +1515,7 @@ class MoveEvent: public Event {
} else { } else {
target = targetOrRegister(c, dst); target = targetOrRegister(c, dst);
cost = src->source->copyCost(c, target); cost = src->source->copyCost(c, target);
if (cost == 0) { if (cost == 0 and (isLoad or isStore)) {
target = src->source; target = src->source;
} }
} }
@ -1521,9 +1524,7 @@ class MoveEvent: public Event {
nextRead(c, src); nextRead(c, src);
} }
bool isStore = dst->reads == 0; assert(c, isLoad or isStore or target != src->source);
assert(c, isStore or target != src->source or src->reads == 0);
if (not isStore) { if (not isStore) {
addSite(c, stack, size, dst, target); addSite(c, stack, size, dst, target);