]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390: Remove Put(...) = Get(...) when the offsets are identical.
authorFlorian Krohm <flo2030@eich-krohm.de>
Thu, 25 Jun 2026 22:22:20 +0000 (22:22 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Thu, 25 Jun 2026 22:22:20 +0000 (22:22 +0000)
Interestingly this pattern is observed. Not sure whether it's worthwhile
to add a peephole optimisation pass after tree building.
VexTranslateArgs::finaltidy looks like a candidate but it appears
to be indended for tools.

VEX/priv/host_s390_isel.c

index abf026eb168d0b15dd24c7f60b84780971e3806b..c29e9d7862265f5a36641cd1d388b994cdfbb034 100644 (file)
@@ -5075,6 +5075,12 @@ s390_isel_stmt(ISelEnv *env, IRStmt *stmt)
       s390_amode *am;
       ULong new_value, old_value, difference;
 
+      /* Peephole optimization:  PUT(...) = GET:I64(...) can be thrown out
+         iff guest state offsets are identical. */
+      if (stmt->Ist.Put.data->tag == Iex_Get &&
+          stmt->Ist.Put.data->Iex.Get.offset == stmt->Ist.Put.offset)
+         return;
+
       /* Detect updates to certain guest registers. We track the contents
          of those registers as long as they contain constants. If the new
          constant is either zero or in the 8-bit neighbourhood of the