[mlir][Canonicalize] Fix command-line options

The canonicalize command-line options currently have no effect, as the pass is
reading the pass options in its constructor, before they're actually
initialized. This results in the default values of the options always being used.

The change here moves the initialization of the `GreedyRewriteConfig` out of the
constructor, so that it runs after the pass options have been parsed.

Fixes #55466

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D125621
diff --git a/mlir/test/Transforms/test-canonicalize.mlir b/mlir/test/Transforms/test-canonicalize.mlir
index b845293..2181d18 100644
--- a/mlir/test/Transforms/test-canonicalize.mlir
+++ b/mlir/test/Transforms/test-canonicalize.mlir
@@ -1,4 +1,5 @@
 // RUN: mlir-opt %s -pass-pipeline='func.func(canonicalize)' | FileCheck %s
+// RUN: mlir-opt %s -pass-pipeline='func.func(canonicalize{region-simplify=false})' | FileCheck %s --check-prefixes=CHECK,NO-RS
 
 // CHECK-LABEL: func @remove_op_with_inner_ops_pattern
 func.func @remove_op_with_inner_ops_pattern() {
@@ -89,3 +90,15 @@
   // CHECK: return %[[CST]]
   return %0 : i32
 }
+
+// Check that the option to control region simplification actually works
+// CHECK-LABEL: test_region_simplify
+func.func @test_region_simplify() {
+  // CHECK-NEXT:   return
+  // NO-RS-NEXT: ^bb1
+  // NO-RS-NEXT:   return
+  // CHECK-NEXT: }
+  return
+^bb1:
+  return
+}