diff options
author | Quentin Carbonneaux <quentin@c9x.me> | 2022-12-13 10:50:27 +0100 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2022-12-15 09:30:47 +0100 |
commit | 99fea1e21174b18ccbd947787bea91140fd802e8 (patch) | |
tree | 109fe6ff6dd10595ea1102fef23c55f58f3ba214 /load.c | |
parent | 26c1c30b7d96d2170195970a8cdb3b024ba7421a (diff) | |
download | roux-99fea1e21174b18ccbd947787bea91140fd802e8.tar.gz |
bugfix in load elimination
When checking if two slices represent the same range of memory we must check that offsets match. The bug was revealed by a harec test.
Diffstat (limited to 'load.c')
-rw-r--r-- | load.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/load.c b/load.c index 551d02e..6f40cc7 100644 --- a/load.c +++ b/load.c @@ -248,6 +248,7 @@ def(Slice sl, bits msk, Blk *b, Ins *i, Loc *il) } else if (i->op == Oblit1) { assert(rtype(i->arg[0]) == RInt); sz = abs(rsval(i->arg[0])); + assert(i > b->ins); --i; assert(i->op == Oblit0); r1 = i->arg[1]; @@ -321,6 +322,7 @@ def(Slice sl, bits msk, Blk *b, Ins *i, Loc *il) for (ist=ilog; ist<&ilog[nlog]; ++ist) if (ist->isphi && ist->bid == b->id) if (req(ist->new.phi.m.ref, sl.ref)) + if (ist->new.phi.m.off == sl.off) if (ist->new.phi.m.sz == sl.sz) { r = ist->new.phi.p->to; if (msk != msks) |