Re: [PATCH 1/2] Assign vertex weight to all nodes
Richard Biener <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 20 Aug 2026, Richard Sandiford wrote: > Richard Biener <[email protected]> writes: > > On Thu, 20 Aug 2026, Richard Sandiford wrote: > >> Richard Biener <[email protected]> writes: > >> > SLP permute nodes (can) have no SLP_TREE_REPRESENTATIVE, avoid > >> > leaving vertex weight (later used for costing) at zero but > >> > assign weight based on the region entry block. > >> > >> That's better than 0 :) but is there a plan to make the choice of > >> block more accurate in future? Using the entry block for something > >> that actually ends up in a loop would defeat the speed-based costing. > > > > Well, permutes are invented by the vectorizer, so they do not have > > a natural "block choice". One could assign a weigth based on the > > weigth of the permuted operands (possibly recursively) or it's > > uses. Or based on the place where we'd code generate it (which > > is based on the operands places). But the processing doesn't walk > > the graph in a particular oder, so that looked iffy to implement. > > Maybe it could be another field in the SLP node, calculated separately? Note the info isn't there. > I think the situation would be worth a ??? comment, but otherwise the > patch seems ok to me FWIW. We could try defining vect_slp_node_weight recursively itself, but then this seems like the wrong place to iterate when we have the graph available at the caller (we'd also need to guard against cycles there at least). I have added ??? comments (also to vect_optimize_slp_pass::containing_loop). Richard. -- Richard Biener <[email protected]> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Jochen Jaser, Andrew McDonald, Abhinav Puri; (HRB 36809, AG Nuernberg)