This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] findOptimalMemOpLowering. NFC.
ClosedPublic

Authored by SjoerdMeijer on Mar 25 2019, 6:49 AM.

Details

Summary

This was a local static funtion in SelectionDAG, which I've promoted to
TargetLowering so that I can reuse this to estimate the cost of a memory
operation.

Diff Detail

Repository
rL LLVM

Event Timeline

SjoerdMeijer created this revision.Mar 25 2019, 6:49 AM
SjoerdMeijer marked an inline comment as done.Mar 25 2019, 9:19 AM
SjoerdMeijer added inline comments.
lib/CodeGen/SelectionDAG/TargetLowering.cpp
165 ↗(On Diff #192123)

It's not convenient to pass the DAG, because it's unavailable from TTI where I would like to call and reuse this findOptimalMemOpLowering function. But since the DAG is only used to pass the MachineFunction to getOptimalMemOpType, which only uses it to get the Function, I am going to change findOptimalMemOpLowering and getOptimalMemOpType to take a Function as their last argument.

With the prep work done in D59785, findOptimalMemOpLowering takes a Function as a last argument so that it can actually be used as shown in the work-in-progress patch D59787.

Summarising, these are the patch sets that we need, i.e. the patches that show the whole flow:

  1. D59785 [TargetLowering] Change getOptimalMemOpType to take a Function instead of a MachineFunction
  2. D59766 [TargetLowering] findOptimalMemOpLowering. NFC. (this patch)
  3. D59787 [ARM] WIP: implement TTI:getMemcpyCost (work in progress)

Restored the comments.

Changed the assert into an early return from function findOptimalMemOpLowering.
We might run into this assert when we actually start using this in D59787.

SjoerdMeijer added a reviewer: samparker.

In line with your other patch, D59785, can't we just pass AttributeList instead of a Function too?

Thanks for looking!
Comments addressed; now passing the function attributes.

samparker accepted this revision.Apr 30 2019, 12:14 AM

LGTM, cheers!

This revision is now accepted and ready to land.Apr 30 2019, 12:14 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2019, 3:09 AM