|
From: Florian K. <br...@ac...> - 2012-06-09 11:53:27
Attachments:
guard-patch
|
do_shadow_Store generates a shadow store. It takes a guard expression
that has the condition under which the store happens.
do_shadow_Store does a definedness check on the address of the store
by calling complainIfUndefined.
However, that check is performed even when the guard condition is not
true. I.e. there could be a valgrind complaint about an undefined
address although that address is not written to (read from).
This patch attempts to correct that. The complaint is only issued when
the guard condition is true.
To do so, complainIfUndefined gets an additional argument which is the
guard expression. This causes a lot of boring ripple, because the
function is invoked a lot. The meat of the patch is this hunk:
@@ -1191,6 +1191,17 @@
di = unsafeIRDirty_0_N( nargs/*regparms*/, nm,
VG_(fnptr_to_fnentry)( fn ), args );
di->guard = cond;
+
+ /* If the complaint is to be issued under a guard condition, AND that
+ guard condition. */
+ if (guard) {
+ IRAtom *g1 = assignNew('V', mce, Ity_I32, unop(Iop_1Uto32,
di->guard));
+ IRAtom *g2 = assignNew('V', mce, Ity_I32, unop(Iop_1Uto32, guard));
+ IRAtom *e = assignNew('V', mce, Ity_I32, binop(Iop_And32, g1, g2));
+
+ di->guard = assignNew('V', mce, Ity_I1, unop(Iop_32to1, e));
+ }
+
setHelperAnns( mce, di );
stmt( 'V', mce, IRStmt_Dirty(di));
Any comments on the patch would be appreciated. I'll wait for those
before checking this in.
Florian
|