From: Lars Knoll Date: Wed, 12 Dec 2012 17:21:36 +0000 (+0100) Subject: Remove references to deleted basic blocks X-Git-Tag: upstream/5.2.1~669^2~659^2~714 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c397f6b2afabe7323141dd68cfb38d66761fc3f;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/qv4codegen.cpp b/qv4codegen.cpp index d9ac31d..a16d8c4 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