This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH updated/ fixed] Put RTL passes under the pass manager

Ok for mainline if the darwin check finishes well?

It's finished now. There is a single change, which happens because of this small change:

in tree-optimize.c:

-  register_dump_files (all_passes, false, PROP_gimple_any
-                                         | PROP_gimple_lcf
-                                         | PROP_gimple_leh
-                                         | PROP_cfg);
-  register_dump_files (all_ipa_passes, true, PROP_gimple_any
-                                            | PROP_gimple_lcf
-                                            | PROP_gimple_leh
-                                            | PROP_cfg);

in passes.c:

+  register_dump_files (all_passes, false, PROP_gimple_leh
+                                         | PROP_cfg);
+  register_dump_files (all_ipa_passes, true, PROP_gimple_leh
+                                            | PROP_cfg);

This hunk is needed to remove -fdump-tree-expand (present after Honza's CFG inlining patch) and reinstate -fdump-rtl-expand. (With my patch, and without this small change, all the RTL dumps would be moved to -fdump-tree-* options, not only -fdump-rtl-expand!).

Because of this change, only PROP_gimple_leh is set while running all_passes. Since the expand pass destroys PROP_gimple_leh, in_gimple_form is reset to 0 just before the expand pass:

+  /* Note that the folders should only create gimple expressions.
+     This is a hack until the new folder is ready.  */
+  in_gimple_form = (pass->properties_provided & PROP_trees) != 0;

Then, when expanding a switch statement whose lowest case value is 0, fold has the nice idea of transforming (var - 0) into non_lvalue(var), and this propagates all the way through the expander. The (untested) solution could be to set/reset in_gimple_form in tree_rest_of_compilation, setting it just before executing all_passes and resetting it just after it.

The attached testcase shows this behavior (look at the expand dump).

Given this analysis, I ask to commit the patch as is and look into this workaround as a follow-up patch.

struct tree_type
  unsigned mode : 7;

extern void f();
extern void g();
extern void h();

void a (struct tree_type type)
  unsigned mode = type.mode;
  switch (mode)
    case 2: f (); break;
    case 1: case 4: g (); break;
    case 0: case 3: h (); break;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]