This is an archive of the discontinued LLVM Phabricator instance.

[TTI] Add getPHICost to better cost phi operands. NFCI
Changes PlannedPublic

Authored by luke on Apr 25 2023, 10:18 AM.



In order to better account for the cost of constant materialization in phis, specifically in the SLP vectorizer, we would like to start providing targets information about their operands via OperandValueInfo.

This patch separates out phi instructions from getCFInstrCost so we can pass the type as well as information about the incoming values, i.e. if they are constant or not.

Diff Detail

Event Timeline

luke created this revision.Apr 25 2023, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2023, 10:18 AM
luke requested review of this revision.Apr 25 2023, 10:18 AM
luke added inline comments.Apr 25 2023, 10:21 AM

I split out PHIs from getCFInstrCost here because it didn't seem to make any sense for return/branch/switch to have Type and OperandValueInfo arguments

luke edited the summary of this revision. (Show Details)Apr 25 2023, 10:35 AM
ABataev accepted this revision.Apr 27 2023, 10:22 AM

LG with a nit


std::nullopt instead of {}

This revision is now accepted and ready to land.Apr 27 2023, 10:22 AM
luke added a reviewer: asb.Apr 28 2023, 2:15 AM
asb added a comment.May 3 2023, 4:14 AM

Does it make sense to copy across the "branches are assumed to be predicted" comment as you currently do?

luke planned changes to this revision.Jun 29 2023, 5:53 AM

After discussing offline with @reames, we're not sure if D149169 is the most accurate way to model constant costs in phi nodes. Moving it off the review queue for the meantime