On 6/6/2026 6:32 AM, Georg-Johann Lay wrote:
Am 06.06.26 um 00:17 schrieb Jeffrey Law:
On 6/5/2026 3:25 AM, Georg-Johann Lay via Gcc wrote:
In match.pd there are two kinds of patterns: Canonicalizations
and optimizations.
While canonicalizations simplify the compile task by reducing
combinatorial complexity, optimization patterns try to improve
code performance.
The trouble with the optimization patterns is that they operate
blindly,
not considering costs or target capabilities in any way.
[ ... ]
This would go against guiding principles in the gimple phases.
Essentially we very much have avoided things like target costing in
gimple. That's part of what makes gimple transformations predictable
and relatively easy to evaluate.
At no point I proposed to introduce costing.
All I said is that match.pd /is/ doing "optimizations" without using
any metric, which is a correct statement as far as I know.
And without a metric, you have no idea where you are heading.
That works for trivial cases like x * 0 = 0, and when all the
dozens of targets behave similar in this regard.
There are cases though where different targets means different metrics.
You may not not explicitly mentioned costing, but the net effect is the
same -- the targets end up making arbitrary changes to the gimple IL and
that's what we've fundamentally wanted to avoid since the initial
development of the tree-ssa work.
Jeff