diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-12-12 18:21:36 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-12-12 10:05:44 +0100 |
commit | 3c397f6b2afabe7323141dd68cfb38d66761fc3f (patch) | |
tree | aee8b4640a653f31b31a92e406f8682ab036312e /qv4codegen.cpp | |
parent | 249f697824275598c85a0ca8f618e6e558a75ade (diff) |
Remove references to deleted basic blocks
When linearizing, we can sometimes remove some basic blocks
that are never being jumped to. In this case we also need to
clean up the back references to these blocks from other
blocks.
This fixes a valgrind error with SHOW_CODE=1
Change-Id: I07d74cef24d6cf2c8bcc1e748e314a3a5b5ed60a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qv4codegen.cpp')
-rw-r--r-- | qv4codegen.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qv4codegen.cpp b/qv4codegen.cpp index d9ac31d91e..a16d8c4d9e 100644 --- a/qv4codegen.cpp +++ b/qv4codegen.cpp @@ -1490,8 +1490,14 @@ void Codegen::linearize(IR::Function *function) trace.append(exitBlock); foreach (IR::BasicBlock *b, function->basicBlocks) - if (!trace.contains(b)) + if (!trace.contains(b)) { + foreach (IR::BasicBlock *out, b->out) { + int idx = out->in.indexOf(b); + assert(idx >= 0); + out->in.remove(idx); + } delete b; + } function->basicBlocks = trace; #ifndef QV4_NO_LIVENESS |