diff options
| author | Quentin Carbonneaux <[email protected]> | 2017-02-06 14:38:47 -0500 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2017-02-06 15:58:09 -0500 |
| commit | 8215b50a10e240581bd1f9e8ae4d13c48f865c6c (patch) | |
| tree | a6c76c644f31a317262838408c01e1ef913130e7 /fold.c | |
| parent | 1a76fd11f501d0bf762e01661d8a67c18c3e01bd (diff) | |
fix edge deletion bug in sccp
When an edge is deleted, the phis and predecessors of the
destination block have to be updated. This is what blkdel()
was doing, but at a level too coarse. The new function
edgedel() allows to remove a single edge (and takes care of
multiple edges).
Diffstat (limited to 'fold.c')
| -rw-r--r-- | fold.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -275,7 +275,8 @@ fold(Fn *fn) d = 1; if (debug['F']) fprintf(stderr, "%s ", b->name); - blkdel(b); + edgedel(b, &b->s1); + edgedel(b, &b->s2); *pb = b->link; continue; } @@ -296,11 +297,14 @@ fold(Fn *fn) renref(&i->arg[n]); renref(&b->jmp.arg); if (b->jmp.type == Jjnz && rtype(b->jmp.arg) == RCon) { - b->jmp.type = Jjmp; - if (czero(&fn->con[b->jmp.arg.val], 0)) + if (czero(&fn->con[b->jmp.arg.val], 0)) { + edgedel(b, &b->s1); b->s1 = b->s2; + b->s2 = 0; + } else + edgedel(b, &b->s2); + b->jmp.type = Jjmp; b->jmp.arg = R; - b->s2 = 0; } pb = &b->link; } |
