This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] Change getOptimalMemOpType to take a function attribute list
ClosedPublic

Authored by SjoerdMeijer on Mar 25 2019, 11:07 AM.

Details

Summary

The MachineFunction wasn't used in getOptimalMemOpType, and this allows reuse of
findOptimalMemOpLowering that is calling getOptimalMemOpType.

This is the groundwork for the change in D59766

Diff Detail

Repository
rL LLVM

Event Timeline

SjoerdMeijer created this revision.Mar 25 2019, 11:07 AM
fhahn added a subscriber: fhahn.Mar 26 2019, 3:04 PM

I glanced over the implementations and it seems like they only use the function to check its attributes. If that's the case, IMO we should just pass that in as a flag (or just the attributes), rather than unnecessarily passing in the function (requiring access to the function seems a bit odd to me, just to get the memory operation type)

Hi Florian, thanks for taking a look!

I glanced over the implementations and it seems like they only use the function to check its attributes.

Yep, that's correct. Most implementations don't actually use it, but if they do, they query the function attributes.

(requiring access to the function seems a bit odd to me, just to get the memory operation type)

The MachineFunction is definitely a bit odd. I definitely don't mind passing just the function attributes, but thought that passing the Function would not be totally unreasonable, as we keep our options more open just in case someone would like to use it (perhaps downstream users).

Hi Florian, just to clarify my previous message. I would be more than happy to change it, but was only curious if just passing function attributes was too restrictive somehow. Let me know what you think. Would you mind having a quick look at D59787 too? :-) Cheers.

SjoerdMeijer retitled this revision from [TargetLowering] Change getOptimalMemOpType to take a Function instead of a MachineFunction to [TargetLowering] Change getOptimalMemOpType to take a function attribute list.
SjoerdMeijer added a reviewer: samparker.

Pass the Function AttributeList instead of a Function.

samparker accepted this revision.Apr 29 2019, 1:51 AM

LGTM, just change to pass by reference before submitting.

include/llvm/CodeGen/TargetLowering.h
1407 ↗(On Diff #196843)

This should be a reference.

This revision is now accepted and ready to land.Apr 29 2019, 1:51 AM

Thanks for reviewing!

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2019, 1:37 AM
Herald added a subscriber: jrtc27. · View Herald Transcript