public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bin.Cheng" <amker.cheng@gmail.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: [PATCH GCC]Improve overflow in scev by using information computed in loop niter, part II
Date: Tue, 26 May 2015 12:19:00 -0000	[thread overview]
Message-ID: <CAHFci29fhP1kK9HC=mcvh2SqbOw-4WbkaaYpf8MFZ7WV1mx89A@mail.gmail.com> (raw)

Hi,
The first part patch improving how we handle overflow in scev is
posted at https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01795.html .
Here comes the second part patch.

This patch does below improvements:
  1) Computes and records control iv for each loop's exit edge.  This
provides a way to compute overflow information in loop niter and use
it in different customers.  It think it's useful, especially with
option -funsafe-loop-optimizers.
  2) Improve chrec_convert by adding new interface
loop_exits_before_overflow.  It checks if a converted IV overflows
wrto its type and loop using overflow information of loop's control
iv.  This basically propagates no-overflow information from control iv
to ivs converted from control iv.  Moreover, we can further improve
the logic by using possible VRP information in the future.

With this patch, cases like scev-9.c and scev-10.c in patch can be
handled now.  Cases reported in PR48052 can be vectorized too.
Opinions?

Thanks,
bin


2015-05-26  Bin Cheng  <bin.cheng@arm.com>

    * cfgloop.h (struct control_iv): New.
    (struct loop): New field control_ivs.
    * tree-ssa-loop-niter.c : Include "stor-layout.h".
    (number_of_iterations_lt): Set no_overflow information.
    (number_of_iterations_exit): Init control iv in niter struct.
    (record_control_iv): New.
    (estimate_numbers_of_iterations_loop): Call record_control_iv.
    (loop_exits_before_overflow): New.  Interface factored out of
    scev_probably_wraps_p.
    (scev_probably_wraps_p): Factor loop niter related code into
    loop_exits_before_overflow.
    (free_numbers_of_iterations_estimates_loop): Free control ivs.
    * tree-ssa-loop-niter.h (free_loop_control_ivs): New.

gcc/testsuite/ChangeLog
2015-05-26  Bin Cheng  <bin.cheng@arm.com>

    PR tree-optimization/48052
    * gcc.dg/tree-ssa/scev-8.c: New.
    * gcc.dg/tree-ssa/scev-9.c: New.
    * gcc.dg/tree-ssa/scev-10.c: New.
    * gcc.dg/vect/pr48052.c: New.

             reply	other threads:[~2015-05-26 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 12:19 Bin.Cheng [this message]
2015-06-01 10:41 ` Richard Biener
2015-06-01 10:46   ` Bin.Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHFci29fhP1kK9HC=mcvh2SqbOw-4WbkaaYpf8MFZ7WV1mx89A@mail.gmail.com' \
    --to=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).