Adding compilation reentrancy tests and new HAL pipeline phases. (#12503)

Two new `--compile-to=` phases are supported:
- `executable-sources`: run just past interface materialization where
`hal.executable` ops with target configurations are present.
- `executable-targets`: run just past executable translation where
`hal.executable.variant` ops have been lowered to their final MLIR form
before linking and serialization (LLVM dialect, SPIR-V dialect, etc).

New tests are added that demonstrate and verify that iree-opt pipelines
can be run piecewise to produce a final output and that `--compile-to=`
at any particular phase can be passed back in and lowered down to a
final output.

A few passes were tweaked to ensure these tests pass.
diff --git a/tools/test/compile_to_phase.mlir b/tools/test/compile_to_phase.mlir
index cb3a8ed..b88dcac 100644
--- a/tools/test/compile_to_phase.mlir
+++ b/tools/test/compile_to_phase.mlir
@@ -1,20 +1,31 @@
-// RUN: iree-compile --compile-to=input --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=INPUT-PHASE
+// RUN: iree-compile --compile-to=input %s | FileCheck %s --check-prefix=INPUT-PHASE
 // INPUT-PHASE: func.func @abs(%[[ARG0:.+]]: tensor<f32>)
 // INPUT-PHASE: math.absf %[[ARG0]] : tensor<f32>
 
-// RUN: iree-compile --compile-to=abi --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=ABI-PHASE
+// RUN: iree-compile --compile-to=abi %s | FileCheck %s --check-prefix=ABI-PHASE
 // ABI-PHASE: func.func @abs(%[[ARG0:.+]]: !hal.buffer_view)
 // ABI-PHASE: %[[INPUT:.+]] = hal.tensor.import %[[ARG0]] : !hal.buffer_view -> tensor<f32>
 // ABI-PHASE: math.absf %[[INPUT]] : tensor<f32>
 
-// RUN: iree-compile --compile-to=flow --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=FLOW-PHASE
+// RUN: iree-compile --compile-to=flow %s | FileCheck %s --check-prefix=FLOW-PHASE
 // FLOW-PHASE: flow.executable.export public @abs_dispatch_0
 // FLOW-PHASE: flow.dispatch @abs_dispatch_0
 
-// RUN: iree-compile --compile-to=stream --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=STREAM-PHASE
+// RUN: iree-compile --compile-to=stream %s | FileCheck %s --check-prefix=STREAM-PHASE
 // STREAM-PHASE: stream.executable.export public @abs_dispatch_0
 // STREAM-PHASE: stream.cmd.dispatch @abs_dispatch_0
 
+// RUN: iree-compile --compile-to=executable-sources --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=EXECUTABLE-SOURCES-PHASE
+// EXECUTABLE-SOURCES-PHASE: hal.executable private @abs_dispatch_0
+// EXECUTABLE-SOURCES-PHASE: hal.executable.variant
+// EXECUTABLE-SOURCES-PHASE: linalg.generic
+// EXECUTABLE-SOURCES-PHASE: math.absf
+
+// RUN: iree-compile --compile-to=executable-targets --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=EXECUTABLE-TARGETS-PHASE
+// EXECUTABLE-TARGETS-PHASE: hal.executable private @abs_dispatch_0
+// EXECUTABLE-TARGETS-PHASE: hal.executable.variant
+// EXECUTABLE-TARGETS-PHASE: vm.abs.f32
+
 // RUN: iree-compile --compile-to=hal --iree-hal-target-backends=vmvx %s | FileCheck %s --check-prefix=HAL-PHASE
 // HAL-PHASE: hal.executable private @abs_dispatch_0
 // HAL-PHASE: hal.executable.binary