On Tue, 2020-09-01 at 13:47 +0200, Martin Liška wrote:
> Hello.
> 
> There's a new version of the patch attempt. I mentioned couple of
> issues with the v1 here:
> https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542821.html
> 
> The patch addresses the biggest blocker which fact that the
> optimization was done unconditionally.
> Now the transformation happens only when a bit test or (and) a jump
> table can be created.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression
> tests. I'm also sending list
> of if-chains that are transformed in GCC.
> 
> Thoughts?
> Thanks,
> Martin

Hopefully someone with deeper knowledge of gimple optimizations can
review the patch properly, but here are a few nits I spotted (sorry):

> gcc/ChangeLog:

The older version of the patch had:
        PR tree-optimization/14799
        PR ipa/88702
in both ChangeLog entries.  Should this version?

>       * Makefile.in: Add new gimple-if-to-switch.o.
>       * common.opt: Add new option.
>       * dbgcnt.def (DEBUG_COUNTER): Add new debug counter.
>       * doc/invoke.texi:

Presumably "Document -fconvert-if-to-switch." or somesuch.

>       * opts.c:

Presumably: "Add -fconvert-if-to-switch at OPT_LEVELS_2_PLUS." or
somesuch.

>       * passes.def: Register new pass.
>       * timevar.def (TV_TREE_IF_TO_SWITCH): Add new time variable.
>       * tree-pass.h (make_pass_if_to_switch): New.
>       * tree-switch-conversion.h: New file.
>       * gimple-if-to-switch.c: New file.

I believe new C++ source files should have a ".cc" suffix.

> gcc/testsuite/ChangeLog:

(as above re bugzilla entries)

>       * gcc.dg/tree-ssa/reassoc-32.c:

Presumably: "Add -fno-convert-if-to-switch."

>       * gcc.dg/tree-ssa/if-to-switch-1.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-2.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-3.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-4.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-5.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-6.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-7.c: New test.
>       * gcc.dg/tree-ssa/if-to-switch-8.c: New test.


Hope this is constructive
Dave

Reply via email to