This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v4 2/3] Add predict_doloop_p target hook
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: "Kewen.Lin" <linkw at linux dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>, wschmidt at linux dot ibm dot com, bin dot cheng at linux dot alibaba dot com, jakub at redhat dot com, Kugan Vivekanandarajah <kugan dot vivekanandarajah at linaro dot org>
- Date: Fri, 14 Jun 2019 16:53:52 -0500
- Subject: Re: [PATCH v4 2/3] Add predict_doloop_p target hook
- References: <1558064130-111037-1-git-send-email-linkw@linux.ibm.com> <alpine.LSU.2.20.1905201122310.10704@zhemvz.fhfr.qr> <20190520102439.GT31586@gate.crashing.org> <b88b2031-28a2-4c87-b6fc-9685ee08c25f@redhat.com> <20190520163759.GY31586@gate.crashing.org> <e8a1d9e1-e2f7-9d85-393f-1784055664ad@linux.ibm.com> <alpine.LSU.2.20.1905211219190.10704@zhemvz.fhfr.qr> <3d3347ad-6910-a5ea-11f9-1a4fc3cbc6d0@linux.ibm.com> <alpine.LSU.2.20.1906111416030.10704@zhemvz.fhfr.qr> <be9ee2a2-0a67-6ca1-fee8-699189df7413@linux.ibm.com>
Hi Kewen,
On Thu, Jun 13, 2019 at 01:50:05PM +0800, Kewen.Lin wrote:
> Comparing with the previous version, I dropped the checks
> on costly niter and invalid stmt scanning. As Richard's
> suggestion, keep this as simple as possible, refine it
> if finding any cases which matter later.
I think we'll want the invalid statement thing back pretty soon, it just
happens too often (20% of the time), and it makes ivopts make bad decisions.
It does not matter (much) for the performance of the generated code, but
still :-)
> +/* Predict whether the given loop in gimple will be transformed in the RTL
> + doloop_optimize pass. This is for rs6000 target specific. */
Everything in rs6000/ is target-specific ;-) Remove that part?
> + /* On rs6000, targetm.can_use_doloop_p is actually
> + can_use_doloop_if_innermost. Just ensure it's innermost. */
"the loop is innermost".
> + fprintf (dump_file, "Predict doloop failure due to"
> + " no innermost.\n");
"due to no innermost" isn't great, but I don't know how th phrase it
better, either :-/ It's just debug output of course, so not so very
important.
> +This target hook is required only when the target supports low-overhead
> +loops, and will help some earlier middle-end passes to make some decisions.
Maybe just say it is for ivopts? Or say that targets that do support
low-overhead loops *should* implement it?
> +/* True if we can predict this loop is possible to be transformed to a
> + low-overhead loop, otherwise returns false.
"Return true if we predict the loop LOOP will be transformed to a
low-overhead loop, otherwise return false"? Or mention doloop_optimize
like below:
> +/* Predict whether the given loop will be transformed in the RTL
> + doloop_optimize pass. Attempt to duplicate some doloop_optimize checks.
> + This is only for target independent checks, see targetm.predict_doloop_p
> + for the target dependent ones.
> +
> + Note that according to some initial investigation, some checks like costly
> + niter check and invalid stmt scanning don't have much gains among general
> + cases, so keep this as simple as possible first.
> +
> + Some RTL specific checks seems unable to be checked in gimple, if any new
> + checks or easy checks _are_ missing here, please add them. */
Good useful note, thanks :-)
The rs6000 part is okay for trunk. Thanks!
Segher