|
From: <sv...@va...> - 2012-03-27 10:19:49
|
sewardj 2012-03-27 11:19:39 +0100 (Tue, 27 Mar 2012)
New Revision: 12467
Log:
/* Do expensive interpretation for Iop_Add32 and Iop_Add64 on
Darwin. 10.7 is mostly built with LLVM, which uses these for
bitfield inserts, and we get a lot of false errors if the cheap
interpretation is used, alas. Could solve this much better if
we knew which of such adds came from x86/amd64 LEA instructions,
since these are the only ones really needing the expensive
interpretation, but that would require some way to tag them in
the _toIR.c front ends, which is a lot of faffing around. So
for now just use the slow and blunt-instrument solution. */
Pertains to, although does not completely solve, #242137.
Modified files:
trunk/memcheck/mc_translate.c
Modified: trunk/memcheck/mc_translate.c (+23 -3)
===================================================================
--- trunk/memcheck/mc_translate.c 2012-03-27 11:06:31 +01:00 (rev 12466)
+++ trunk/memcheck/mc_translate.c 2012-03-27 11:19:39 +01:00 (rev 12467)
@@ -188,8 +188,14 @@
/* MODIFIED: indicates whether "bogus" literals have so far been
found. Starts off False, and may change to True. */
- Bool bogusLiterals;
+ Bool bogusLiterals;
+ /* READONLY: indicates whether we should use expensive
+ interpretations of integer adds, since unfortunately LLVM
+ uses them to do ORs in some circumstances. Defaulted to True
+ on MacOS and False everywhere else. */
+ Bool useLLVMworkarounds;
+
/* READONLY: the guest layout. This indicates which parts of
the guest state should be regarded as 'always defined'. */
VexGuestLayout* layout;
@@ -3130,7 +3136,7 @@
return mkLazy2(mce, Ity_I64, vatom1, vatom2);
case Iop_Add32:
- if (mce->bogusLiterals)
+ if (mce->bogusLiterals || mce->useLLVMworkarounds)
return expensiveAddSub(mce,True,Ity_I32,
vatom1,vatom2, atom1,atom2);
else
@@ -3153,7 +3159,7 @@
return doCmpORD(mce, op, vatom1,vatom2, atom1,atom2);
case Iop_Add64:
- if (mce->bogusLiterals)
+ if (mce->bogusLiterals || mce->useLLVMworkarounds)
return expensiveAddSub(mce,True,Ity_I64,
vatom1,vatom2, atom1,atom2);
else
@@ -4908,6 +4914,20 @@
mce.hWordTy = hWordTy;
mce.bogusLiterals = False;
+ /* Do expensive interpretation for Iop_Add32 and Iop_Add64 on
+ Darwin. 10.7 is mostly built with LLVM, which uses these for
+ bitfield inserts, and we get a lot of false errors if the cheap
+ interpretation is used, alas. Could solve this much better if
+ we knew which of such adds came from x86/amd64 LEA instructions,
+ since these are the only ones really needing the expensive
+ interpretation, but that would require some way to tag them in
+ the _toIR.c front ends, which is a lot of faffing around. So
+ for now just use the slow and blunt-instrument solution. */
+ mce.useLLVMworkarounds = False;
+# if defined(VGO_darwin)
+ mce.useLLVMworkarounds = True;
+# endif
+
mce.tmpMap = VG_(newXA)( VG_(malloc), "mc.MC_(instrument).1", VG_(free),
sizeof(TempMapEnt));
for (i = 0; i < sb_in->tyenv->types_used; i++) {
|