This is an archive of the discontinued LLVM Phabricator instance.

const correctness for getTargetTransformInfo
ClosedPublic

Authored by vtjnash on Feb 24 2022, 2:11 PM.

Details

Summary

Seems like this can be const, since Passes shouldn't modify it.

Diff Detail

Event Timeline

vtjnash created this revision.Feb 24 2022, 2:11 PM
vtjnash requested review of this revision.Feb 24 2022, 2:11 PM
vtjnash edited the summary of this revision. (Show Details)Feb 24 2022, 2:13 PM
vtjnash added a reviewer: wsmoses.
vtjnash added a subscriber: vchuravy.

This isn't const *correctness*, this is adding a new restriction. The existing code is totally correct, but this potentially makes downstream code no longer correct.

This isn't const *correctness*, this is adding a new restriction. The existing code is totally correct, but this potentially makes downstream code no longer correct.

Maintaining state in TTI is definitely bad, so this is a good restriction

This isn't const *correctness*, this is adding a new restriction. The existing code is totally correct, but this potentially makes downstream code no longer correct.

Maintaining state in TTI is definitely bad, so this is a good restriction

Sure, didn't mean to suggest it was a bad change to be making, just that it should be framed accurately rather than in this misleading way (that suggests we currently have a bug)

this is adding a new restriction

It is mostly relaxing a restriction, now allowing getTargetTransformInfo and getTargetIRAnalysis to be called with a const TargetTransformInfo for this

wsmoses accepted this revision.Feb 25 2022, 11:03 AM

Per comments, please change the message to message to something like "Mark X as const", but otherwise LGTM.

This revision is now accepted and ready to land.Feb 25 2022, 11:03 AM
This revision was landed with ongoing or failed builds.Feb 25 2022, 11:31 AM
This revision was automatically updated to reflect the committed changes.