]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ppc64 --track-origins=yes failure because of bad cmov addHRegUse
authorMark Wielaard <mark@klomp.org>
Tue, 8 Feb 2022 15:36:08 +0000 (16:36 +0100)
committerMark Wielaard <mark@klomp.org>
Tue, 8 Feb 2022 15:41:10 +0000 (16:41 +0100)
For Pin_CMov getRegUsage_PPCInstr called addHRegUse for the dst
register with HRmWrite, but since this is a conditional move the
register could be both read and written (read + write = modify).
This matches the dst of Pin_FpCMov and Pin_AvCMov.

In a very rare case, and only with --track-origins=yes, this
could cause bad code generation.

This is slightly amazing, this code is from 2005 and as far as
I know we never seen an issue with --track-origins=yes on power
before. And I have been unable to come up simple reproducer.

https://bugs.kde.org/show_bug.cgi?id=449672

NEWS
VEX/priv/host_ppc_defs.c

diff --git a/NEWS b/NEWS
index ef3eef23dd3ed241a748bc61db5d4b02358ea41a..ff8af76566a7e0d32f19e60ed5f1f8d3faf45ded 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 447995  Valgrind segfault on power10 due to hwcap checking code
 449483  Powerpc: vcmpgtsq., vcmpgtuq,, vcmpequq. instructions not setting the
         condition code correctly.
+449672  ppc64 --track-origins=yes failures because of bad cmov addHRegUse
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
index 3ae0f6e08270abe52530f86226bc87ee6952d7a7..4222b47868503527be7b72bef7f5ea6addec8a73 100644 (file)
@@ -2590,7 +2590,7 @@ void getRegUsage_PPCInstr ( HRegUsage* u, const PPCInstr* i, Bool mode64 )
       return;
    case Pin_CMov:
       addRegUsage_PPCRI(u,  i->Pin.CMov.src);
-      addHRegUse(u, HRmWrite, i->Pin.CMov.dst);
+      addHRegUse(u, HRmModify, i->Pin.CMov.dst);
       return;
    case Pin_Load:
       addRegUsage_PPCAMode(u, i->Pin.Load.src);