From 08a1921eb79e49cf4c369bfd0aea8114238a446d Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 19 May 2008 07:44:39 -0600 Subject: [PATCH] only set target equal to src->source in MoveEvent.compile if it is a simple load or store --- src/compiler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index d3aa2751cf..9d00f5dc4e 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1500,6 +1500,9 @@ class MoveEvent: public Event { fprintf(stderr, "MoveEvent.compile\n"); } + bool isLoad = src->reads->next == 0; + bool isStore = dst->reads == 0; + Site* target; unsigned cost; if (type == Move @@ -1512,7 +1515,7 @@ class MoveEvent: public Event { } else { target = targetOrRegister(c, dst); cost = src->source->copyCost(c, target); - if (cost == 0) { + if (cost == 0 and (isLoad or isStore)) { target = src->source; } } @@ -1521,9 +1524,7 @@ class MoveEvent: public Event { nextRead(c, src); } - bool isStore = dst->reads == 0; - - assert(c, isStore or target != src->source or src->reads == 0); + assert(c, isLoad or isStore or target != src->source); if (not isStore) { addSite(c, stack, size, dst, target);