summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bepeephole.c
diff options
context:
space:
mode:
authorSebastian Buchwald <Sebastian.Buchwald@kit.edu>2011-10-17 12:56:23 +0200
committerSebastian Buchwald <Sebastian.Buchwald@kit.edu>2011-10-17 12:58:23 +0200
commit9edd1ecb1f7a2b8ddfbfeccf28ef1e5e4b5ddc19 (patch)
treee6a0ac579a70caabde559154086d9c5191f91e9d /ir/be/bepeephole.c
parentc62cc474a6ab3dcae9cb5fb8bfd0c6cfdcde483a (diff)
Also track extended live ranges.
If the peephole replaced the current node by another node the corresponding value is live before the current node. This fixes x86code/flags.c.
Diffstat (limited to 'ir/be/bepeephole.c')
-rw-r--r--ir/be/bepeephole.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ir/be/bepeephole.c b/ir/be/bepeephole.c
index 3649a91..2c9ebe1 100644
--- a/ir/be/bepeephole.c
+++ b/ir/be/bepeephole.c
@@ -38,6 +38,7 @@
#include "beirg.h"
#include "belive_t.h"
#include "bearch.h"
+#include "beintlive_t.h"
#include "benode.h"
#include "besched.h"
#include "bemodule.h"
@@ -144,10 +145,16 @@ static void be_peephole_before_exchange(const ir_node *old_node,
const arch_register_class_t *cls;
unsigned reg_idx;
unsigned cls_idx;
+ bool old_is_current = false;
DB((dbg, LEVEL_1, "About to exchange and kill %+F with %+F\n", old_node, new_node));
+ assert(sched_is_scheduled(new_node));
+ assert(value_dominates(new_node, old_node));
+
if (current_node == old_node) {
+ old_is_current = true;
+
/* next node to be processed will be killed. Its scheduling predecessor
* must be processed next. */
current_node = sched_next(current_node);
@@ -168,7 +175,7 @@ static void be_peephole_before_exchange(const ir_node *old_node,
reg_idx = arch_register_get_index(reg);
cls_idx = arch_register_class_index(cls);
- if (register_values[cls_idx][reg_idx] == old_node) {
+ if (register_values[cls_idx][reg_idx] == old_node || old_is_current) {
register_values[cls_idx][reg_idx] = new_node;
}