Bug 18395 - [meta-bug] combine needs to be templatized like a peepholer
Summary: [meta-bug] combine needs to be templatized like a peepholer
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: meta-bug, missed-optimization
Depends on: 16798 16458 26190
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-09 12:48 UTC by Nathan Sidwell
Modified: 2020-11-09 02:16 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-05 21:22:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Sidwell 2004-11-09 12:49:00 UTC
This is a catch all bug report to document failures in combine.

There are at least two problems with combine.

1) It only combines chains of instructions that have no other uses of the
intermediate results.

2) It functions by generating promising patterns and then seeing if they exist.
 This is wasteful, in that it generates many patterns  that don't exist on the
particular target, and it is blind in that it doesn't spot any special cases the
target might have.

Really combine, which is a generic peepholer, needs some kind of templatizing on
the target machine.   What's needed is something like pre-reg-alloc peepholes. 
That of course would be a large amount of work.
Comment 1 Eric Gallager 2018-09-21 01:51:12 UTC
I think the way meta-bugs are done has been changed; should the bugs blocking this be moved to "Depends on" instead?
Comment 2 Eric Gallager 2018-12-21 04:45:42 UTC
(In reply to Eric Gallager from comment #1)
> I think the way meta-bugs are done has been changed; should the bugs
> blocking this be moved to "Depends on" instead?

I'm doing that.
Comment 3 Segher Boessenkool 2018-12-21 07:04:36 UTC
1) Isn't true.  But it is true that usually a SET is only tried together
with its first USE (trying all USEs would be quite expensive, probably even
noticably quadratic, and would not normally help.  But maybe trying just the
first and second USE helps?)

2) This is also a strength: combine can find all kinds of pattern that you
never would think of.  But I think an automated peepholer like you describe
could be useful as a separate pass, one you could run more often, for example
right after every splitter pass (on the insns that were split).
Comment 4 Eric Gallager 2019-12-23 05:05:23 UTC
Does the new combine2 pass proposed for GCC 10 address any of these issues?