public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Yuri Rumyantsev <ysrumyan@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
		Igor Zamyatin <izamyatin@gmail.com>
Subject: Re: [PATCH PR64434]
Date: Thu, 15 Jan 2015 11:17:00 -0000	[thread overview]
Message-ID: <CAFiYyc30MhGP-QZV-40GeKDusGJ3w9CFSgnPr+a-RPvBXp10Fg@mail.gmail.com> (raw)
In-Reply-To: <CAEoMCqStGEVk68XULya95AvJ0tncT4A5BoiNB3uQozoXsYb+Ow@mail.gmail.com>

On Thu, Jan 15, 2015 at 10:39 AM, Yuri Rumyantsev <ysrumyan@gmail.com> wrote:
> Hi All,
>
> I did a change proposed by Richard - unconditionally allocate from the heap.
>
> Bootstrap and regression testing did not show any new failures.
>
> Is it OK for trunk?

+      if (!is_gimple_assign (stmt)
+         || gimple_has_volatile_ops (stmt))
+       continue;
+      code = gimple_assign_rhs_code (stmt);
+      if (!commutative_tree_code (code))
+       continue;
+      gcc_assert (gimple_num_ops (stmt) == 3);
+      op0 = gimple_op (stmt, 1);
+      op1 = gimple_op (stmt, 2);
+      if (op0 == NULL_TREE || op1 == NULL_TREE
+         || TREE_CODE (op0) != SSA_NAME
+         || TREE_CODE (op1) != SSA_NAME)
+       continue;

you can simplify this to

         if (!is_gimple_assign (stmt)
            || !commutative_tree_code (gimple_assign_rhs_code (stmt)))
           continue;
         op0 = gimple_assign_rhs1 (stmt);
         op1 = gimple_assign_rhs2 (Stmt);
         if (TREE_CODE (op0) != SSA_NAME
             || TREE_CODE (op1) != SSA_NAME)
           continue;

Please output the computed costs for both operands in

+         if (dump_file && (dump_flags & TDF_DETAILS))
+           {
+             fprintf (dump_file, "Swap operands in stmt:\n");
+             print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+           }

as that will help debugging if odd things happen.

Ok with that changes.  I belive this may fix some duplicate bugs
as well.

Thanks,
Richard.


> ChangeLog
>
> 2015-01-15  Yuri Rumyantsev  <ysrumyan@gmail.com>
>
> PR tree-optimization/64434
> * cfgexpand.c (reorder_operands): New function.
> (expand_gimple_basic_block): Insert call of reorder_operands if
> optimized is true.
>
> gcc/testsuite/ChangeLog
> * gcc.dg/torture/pr64434.c: New test.
>
> 2015-01-14 17:07 GMT+03:00 Yuri Rumyantsev <ysrumyan@gmail.com>:
>> Jakub,
>>
>> I did all changes requested by you.
>>
>> Here is updated patch.
>>
>> BTW I thought that gcc performs splitting of blocks with huge  size.
>>
>>
>> 2015-01-14 16:33 GMT+03:00 Jakub Jelinek <jakub@redhat.com>:
>>> On Wed, Jan 14, 2015 at 04:28:42PM +0300, Yuri Rumyantsev wrote:
>>>> Hi All,
>>>>
>>>> I did all changes proposed by Richard and delete check on def in the
>>>> same block as Jakub proposed.
>>>> I also moved check  on optimization to call site..
>>>>
>>>> I also checked that bootstrap and regression testing did not show any
>>>> new failures.
>>>>
>>>> Is it OK for trunk?
>>>
>>> The  | SSA_OP_VUSE is still in there, the testcase is still executable,
>>> still doesn't end with newline, and I really think you should replace
>>>   lattice = XALLOCAVEC (unsigned int, n);
>>> with something like:
>>>   if (n >= 100000)
>>>     lattice = XNEWVEC (unsigned int, n);
>>>   else
>>>     lattice = XALLOCAVEC (unsigned int, n);
>>> ...
>>>   if (n >= 100000)
>>>     XDELETE (lattice);
>>> or similar.
>>>
>>>         Jakub

      reply	other threads:[~2015-01-15 10:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 10:17 Yuri Rumyantsev
2015-01-14 10:38 ` Jakub Jelinek
2015-01-14 10:40   ` Yuri Rumyantsev
2015-01-14 10:58     ` Jakub Jelinek
2015-01-14 11:14       ` Richard Biener
2015-01-14 11:15         ` Jakub Jelinek
2015-01-14 13:37           ` Yuri Rumyantsev
2015-01-14 13:49             ` Jakub Jelinek
2015-01-14 14:07               ` Richard Biener
2015-01-14 14:26               ` Yuri Rumyantsev
2015-01-15 10:13                 ` Yuri Rumyantsev
2015-01-15 11:17                   ` Richard Biener [this message]

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=CAFiYyc30MhGP-QZV-40GeKDusGJ3w9CFSgnPr+a-RPvBXp10Fg@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=izamyatin@gmail.com \
    --cc=jakub@redhat.com \
    --cc=ysrumyan@gmail.com \
    /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).