summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-02 15:17:34 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-02 15:19:38 -0800
commit3920112fb1060bed3ebecff443d9887330ef0348 (patch)
treede8a45db7e7a740515b8ec6292434d07447de671 /mi
parentc2fe43f61c7d2a8277247db8314bb3d5a4ffb753 (diff)
downloadmc-3920112fb1060bed3ebecff443d9887330ef0348.tar.gz
Don't double label BBs.
If we've already got a BB with a specific label, don't add that label again. Fixes #28
Diffstat (limited to 'mi')
-rw-r--r--mi/cfg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mi/cfg.c b/mi/cfg.c
index f5c6961..12ecc75 100644
--- a/mi/cfg.c
+++ b/mi/cfg.c
@@ -29,8 +29,10 @@ static Bb *mkbb(Cfg *cfg)
static void strlabel(Cfg *cfg, char *lbl, Bb *bb)
{
- htput(cfg->lblmap, lbl, bb);
- lappend(&bb->lbls, &bb->nlbls, lbl);
+ if (htget(cfg->lblmap, lbl) != bb) {
+ htput(cfg->lblmap, lbl, bb);
+ lappend(&bb->lbls, &bb->nlbls, lbl);
+ }
}
static void label(Cfg *cfg, Node *lbl, Bb *bb)