]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Reduce the number of IR sanity checks from 4 per block to 2 per block.
authorJulian Seward <jseward@acm.org>
Fri, 5 Aug 2016 15:02:48 +0000 (15:02 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 5 Aug 2016 15:02:48 +0000 (15:02 +0000)
Also relax assertion checking in the register allocator.

Together with valgrind r15927 this reduces per-block JITting cost by 10%-15%.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3239

VEX/priv/host_generic_reg_alloc2.c
VEX/priv/main_main.c

index fd46486f86a65ab5c6c80be59ec5959dcd112404..3c0b8dbabaf0949f67ea960764b187fd8ae794eb 100644 (file)
@@ -993,13 +993,13 @@ HInstrArray* doRegisterAllocation (
       /* ------------ Sanity checks ------------ */
 
       /* Sanity checks are expensive.  So they are done only once
-         every 13 instructions, and just before the last
+         every 17 instructions, and just before the last
          instruction. */
       do_sanity_check
          = toBool(
               False /* Set to True for sanity checking of all insns. */
               || ii == instrs_in->arr_used-1
-              || (ii > 0 && (ii % 13) == 0)
+              || (ii > 0 && (ii % 17) == 0)
            );
 
       if (do_sanity_check) {
index 8fd2503bb0031f974726abedc8b4dce0cfceab72..e263754c6f690b4a687197ee23d8c05e4c0e9a9d 100644 (file)
@@ -916,8 +916,13 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta )
    irsb = do_iropt_BB ( irsb, specHelper, preciseMemExnsFn, pxControl,
                               vta->guest_bytes_addr,
                               vta->arch_guest );
-   sanityCheckIRSB( irsb, "after initial iropt", 
-                    True/*must be flat*/, guest_word_type );
+
+   // JRS 2016 Aug 03: Sanity checking is expensive, we already checked
+   // the output of the front end, and iropt never screws up the IR by
+   // itself, unless it is being hacked on.  So remove this post-iropt
+   // check in "production" use.
+   // sanityCheckIRSB( irsb, "after initial iropt", 
+   //                  True/*must be flat*/, guest_word_type );
 
    if (vex_traceflags & VEX_TRACE_OPT1) {
       vex_printf("\n------------------------" 
@@ -953,9 +958,12 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta )
       vex_printf("\n");
    }
 
-   if (vta->instrument1 || vta->instrument2)
-      sanityCheckIRSB( irsb, "after instrumentation",
-                       True/*must be flat*/, guest_word_type );
+   // JRS 2016 Aug 03: as above, this never actually fails in practice.
+   // And we'll sanity check anyway after the post-instrumentation
+   // cleanup pass.  So skip this check in "production" use.
+   // if (vta->instrument1 || vta->instrument2)
+   //    sanityCheckIRSB( irsb, "after instrumentation",
+   //                     True/*must be flat*/, guest_word_type );
 
    /* Do a post-instrumentation cleanup pass. */
    if (vta->instrument1 || vta->instrument2) {