From: Julian Seward Date: Tue, 24 Aug 2004 00:37:04 +0000 (+0000) Subject: * setHints_Expr: remember to recurse the entire tree! X-Git-Tag: svn/VALGRIND_3_0_1^2~1137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8199e95fb4606390b1c224cac7d2ce562dacadb0;p=thirdparty%2Fvalgrind.git * setHints_Expr: remember to recurse the entire tree! Not doing so leads to nasty bugs in which the tree-builder incorrectly reorders Gets and Puts. * related: remember PutI is a kind of Put too. git-svn-id: svn://svn.valgrind.org/vex/trunk@197 --- diff --git a/VEX/priv/ir/iropt.c b/VEX/priv/ir/iropt.c index cbb70c2a70..1358534517 100644 --- a/VEX/priv/ir/iropt.c +++ b/VEX/priv/ir/iropt.c @@ -1317,8 +1317,10 @@ static IRStmt* tbSubst_Stmt ( Hash64* env, IRStmt* st ) } -/* Traverse an expr, and detect if any part of it reads memory - or does a Get. */ +/* Traverse an expr, and detect if any part of it reads memory or does + a Get. Be careful ... this really controls how much the + tree-builder can reorder the code, so getting it right is critical. +*/ static void setHints_Expr (Bool* doesLoad, Bool* doesGet, IRExpr* e ) { Int i; @@ -1341,6 +1343,7 @@ static void setHints_Expr (Bool* doesLoad, Bool* doesGet, IRExpr* e ) return; case Iex_LDle: *doesLoad |= True; + setHints_Expr(doesLoad, doesGet, e->Iex.LDle.addr); return; case Iex_Get: *doesGet |= True; @@ -1510,7 +1513,7 @@ static void treebuild_BB ( IRBB* bb ) appeared. (Stupid algorithm): first, mark all bindings which need to be dumped. Then, dump them in the order in which they were defined. */ - invPut = st->tag == Ist_Put; + invPut = st->tag == Ist_Put || st->tag == Ist_PutI; invStore = st->tag == Ist_STle; for (k = 0; k < env->used; k++) {