In iropt, try and call flatten_BB less.  Enhance the sanity checker
so that it does check for flatness at the relevant places.


git-svn-id: svn://svn.valgrind.org/vex/trunk@683 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/main/vex_main.c b/priv/main/vex_main.c
index dadd897..cbc4084 100644
--- a/priv/main/vex_main.c
+++ b/priv/main/vex_main.c
@@ -315,12 +315,14 @@
    }
 
    /* Sanity check the initial IR. */
-   sanityCheckIRBB(irbb, guest_word_type);
+   sanityCheckIRBB( irbb, "initial IR", 
+                    False/*can be non-flat*/, guest_word_type );
 
    /* Clean it up, hopefully a lot. */
    irbb = do_iropt_BB ( irbb, specHelper, preciseMemExnsFn, 
                               guest_bytes_addr );
-   sanityCheckIRBB(irbb, guest_word_type);
+   sanityCheckIRBB( irbb, "after initial iropt", 
+                    True/*must be flat*/, guest_word_type );
 
    if (vex_traceflags & VEX_TRACE_OPT1) {
       vex_printf("\n------------------------" 
@@ -345,14 +347,16 @@
    }
 
    if (instrument1 || instrument2)
-      sanityCheckIRBB(irbb, guest_word_type);
+      sanityCheckIRBB( irbb, "after instrumentation",
+                       True/*must be flat*/, guest_word_type );
 
    /* Do a post-instrumentation cleanup pass. */
    if (cleanup_after_instrumentation) {
       do_deadcode_BB( irbb );
       irbb = cprop_BB( irbb );
       do_deadcode_BB( irbb );
-      sanityCheckIRBB(irbb, guest_word_type);
+      sanityCheckIRBB( irbb, "after post-instrumentation cleanup",
+                       True/*must be flat*/, guest_word_type );
    }
 
    if (vex_traceflags & VEX_TRACE_OPT2) {