From: Brian Norris Date: Thu, 13 Sep 2012 16:53:59 +0000 (-0700) Subject: model: kill unneeded local variable X-Git-Tag: pldi2013~206 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=51c8be1f188633adb5deb3a34b13d205c0a141f1 model: kill unneeded local variable The "Thread *th" variable is used only on a few control paths, and it is never reused. Might as well just calculate it on the fly. Also, it's recalculated and masked by another local variable at a deeper level of nesting. --- diff --git a/model.cc b/model.cc index b4a3655..4475455 100644 --- a/model.cc +++ b/model.cc @@ -392,11 +392,9 @@ Thread * ModelChecker::check_current_action(ModelAction *curr) break; } - Thread *th = get_thread(curr); - bool updated = false; if (curr->is_read()) { - updated = process_read(curr, th, second_part_of_rmw); + updated = process_read(curr, get_thread(curr), second_part_of_rmw); } if (curr->is_write()) { @@ -415,7 +413,7 @@ Thread * ModelChecker::check_current_action(ModelAction *curr) } mo_graph->commitChanges(); - th->set_return_value(VALUE_NONE); + get_thread(curr)->set_return_value(VALUE_NONE); } if (updated)