public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "undefinedopcode2 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106415] loop-ivopts prevents correct usage of dbra with 16-bit loop counters on m68k
Date: Mon, 25 Jul 2022 17:27:59 +0000	[thread overview]
Message-ID: <bug-106415-4-s288N5Yxpl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106415-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106415

--- Comment #3 from Undefined Opcode <undefinedopcode2 at gmail dot com> ---
Created attachment 53348
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53348&action=edit
dump of buggy optimization pass

(In reply to Andrew Pinski from comment #2)
> I suspect this is a target cost model issue ...
> 
> You can look at the ivopts dump to see the costs there.

Funny, I was just about to reply to the thread about this. It looks like it's
choosing candidate 7. I've also included the candidate 3 info for completeness.
Candidate 3:
  Incr POS: orig biv
  IV struct:
    Type:       short int
    Base:       15
    Step:       -1
    Biv:        N
    Overflowness wrto loop niter:       No-overflow
...
<trimmed>
...
Candidate 7:
  Var befor: ivtmp.19
  Var after: ivtmp.19
  Incr POS: before exit test
  IV struct:
    Type:       unsigned int
    Base:       15
    Step:       4294967295
    Biv:        N
    Overflowness wrto loop niter:       Overflow
...
<trimmed>
...
<Candidate Costs>:
  cand  cost
  0     5
  1     5
  2     5
  3     4
  4     5
  5     5
  6     5
  7     5
  8     5

It's odd to me that it's choosing 7 over 3, since 3 is clearly lower cost. It
also spits out "group candidate costs", but I'm not sure what those actually
represent (sorry, this is my first time poking through GCC optimization
internals).

I've attached a copy of test.c.174t.ivopts if someone else can make more sense
of it.

  parent reply	other threads:[~2022-07-25 17:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 17:32 [Bug tree-optimization/106415] New: " undefinedopcode2 at gmail dot com
2022-07-22 18:50 ` [Bug tree-optimization/106415] " undefinedopcode2 at gmail dot com
2022-07-25 16:51 ` [Bug target/106415] " pinskia at gcc dot gnu.org
2022-07-25 17:27 ` undefinedopcode2 at gmail dot com [this message]
2022-07-26  5:01 ` undefinedopcode2 at gmail dot com
2022-07-26  5:59 ` linkw at gcc dot gnu.org
2022-07-27 18:28 ` undefinedopcode2 at gmail dot com
2022-08-01 23:44 ` undefinedopcode2 at gmail dot com

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=bug-106415-4-s288N5Yxpl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).