From: Julian Seward Date: Sat, 19 Aug 2006 18:31:53 +0000 (+0000) Subject: Comparing a reg with itself produces a result which doesn't depend on X-Git-Tag: svn/VALGRIND_3_3_1^2~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5799c95da9c021569181662dac2d8e3f88f1100;p=thirdparty%2Fvalgrind.git Comparing a reg with itself produces a result which doesn't depend on the contents of the reg. Therefore remove the false dependency, which has been known to cause memcheck to produce false errors for xlc-compiled code. git-svn-id: svn://svn.valgrind.org/vex/trunk@1640 --- diff --git a/VEX/priv/guest-ppc/toIR.c b/VEX/priv/guest-ppc/toIR.c index 296d8e8f1e..7fd3d71469 100644 --- a/VEX/priv/guest-ppc/toIR.c +++ b/VEX/priv/guest-ppc/toIR.c @@ -2936,6 +2936,12 @@ static Bool dis_int_cmp ( UInt theInstr ) switch (opc2) { case 0x000: // cmp (Compare, PPC32 p367) DIP("cmp cr%u,%u,r%u,r%u\n", crfD, flag_L, rA_addr, rB_addr); + /* Comparing a reg with itself produces a result which + doesn't depend on the contents of the reg. Therefore + remove the false dependency, which has been known to cause + memcheck to produce false errors. */ + if (rA_addr == rB_addr) + a = b = mode64 ? mkU64(0) : mkU32(0); if (flag_L == 1) { putCR321(crfD, unop(Iop_64to8, binop(Iop_CmpORD64S, a, b))); } else { @@ -2948,6 +2954,12 @@ static Bool dis_int_cmp ( UInt theInstr ) case 0x020: // cmpl (Compare Logical, PPC32 p369) DIP("cmpl cr%u,%u,r%u,r%u\n", crfD, flag_L, rA_addr, rB_addr); + /* Comparing a reg with itself produces a result which + doesn't depend on the contents of the reg. Therefore + remove the false dependency, which has been known to cause + memcheck to produce false errors. */ + if (rA_addr == rB_addr) + a = b = mode64 ? mkU64(0) : mkU32(0); if (flag_L == 1) { putCR321(crfD, unop(Iop_64to8, binop(Iop_CmpORD64U, a, b))); } else {