Page MenuHomePhabricator

export MachineModuleAnalysis to the new pass manager
Needs ReviewPublic

Authored by vtjnash on Jan 29 2022, 12:22 PM.

Details

Reviewers
ychen
Summary

Followup to https://reviews.llvm.org/D64183, this seems to be one of the
analyses necessary for many of the passes that have not been converted
yet to the NewPM, and already converted but not scheduled?

It seems like this is the way those passes get access to the TargetMachine, if they need it.

Does this need some sort of test? I was experimenting with an external pass, which needed access to the TM from the NewPM, and it seemed to be functional in combination my custom module pass transform, such that this runs MyPass successfully:

opt --mtriple=x86_64-unknown-linux-gnu -enable-new-pm=1 --load-pass-plugin=libjulia-codegen%shlibext -passes='require<machine-module>,MyPass' -S

Diff Detail

Event Timeline

vtjnash created this revision.Jan 29 2022, 12:22 PM
vtjnash requested review of this revision.Jan 29 2022, 12:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2022, 12:22 PM

Wasn't the plan to rename old-pm into codegen-pm?

vtjnash edited the summary of this revision. (Show Details)Jan 29 2022, 12:50 PM
vtjnash added a reviewer: ychen.
vtjnash added a project: Restricted Project.
vtjnash added a subscriber: vchuravy.

I don't know the plan specifics, but I am just exposing an existing analysis pass to the command line that already has been converted, not changing it to define any new passes.

ychen added a comment.Feb 1 2022, 4:51 PM

Thanks for the patch! Could you please describe a little bit on the use case (like why use NewPM + TargetMachine)? Is the pass intended for optimization or codegen? Is it possible to use TargetTransformInfo for your purposes?

TargetTransformInfo does not currently have what I need, but if I can add it there, it would also satisfy my needs. I wanted it for an optimization pass (to pre-populate some codegen decisions earlier in the pipeline for better performance), but it looks like all current in-tree consumers are codegen-related.

ychen added a comment.Feb 2 2022, 10:18 PM

TargetTransformInfo does not currently have what I need, but if I can add it there, it would also satisfy my needs. I wanted it for an optimization pass (to pre-populate some codegen decisions earlier in the pipeline for better performance), but it looks like all current in-tree consumers are codegen-related.

Sounds reasonable. It is target-specific and for the sake of better performance, I think the best bet is to use TargetTransformInfo.