This is an archive of the discontinued LLVM Phabricator instance.

[llvm][X86ISelDAGToDAG] support -{start|stop}-{before|after}=x86-isel
ClosedPublic

Authored by nickdesaulniers on Dec 19 2022, 10:50 AM.

Details

Summary

Follow a similar pattern as AMDGPUDAGToDAGISel's constructor so that we
can use INITIALIZE_PASS to register a pass. This allows for more fine
grain testability of SelectionDAGISel.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 10:50 AM
nickdesaulniers requested review of this revision.Dec 19 2022, 10:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 10:50 AM

I'm happy to go through the other architectures and make similar changes if folks are happy with this direction.

Another thought: should I go though and change SelectionDAGISel's constructor to accept a pointer to the TargetMachine (or std::optional)?

craig.topper added inline comments.Dec 19 2022, 11:02 AM
llvm/include/llvm/InitializePasses.h
421 ↗(On Diff #484012)

I think this should go in X86.h

llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
29

drop this after moving the initialize function to X86.h

llvm/include/llvm/InitializePasses.h
421 ↗(On Diff #484012)

This decl should probably go in llvm/lib/Target/X86/X86.h instead.

nickdesaulniers marked 2 inline comments as done.
  • move decl, drop include
This revision is now accepted and ready to land.Dec 19 2022, 11:06 AM

If I rebase this onto https://reviews.llvm.org/D140349, I can drop some of the diffs I just immediately undo there.

barannikov88 added inline comments.
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
179–180

Q: Is it necessary to override getPassName if the pass is registered? I thought the default implementation would extract the pass name from the registration info.

  • minor fixup from rebase
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
179–180
barannikov88 added inline comments.Dec 19 2022, 2:30 PM
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
179–180

Makes sense, thank you.

nickdesaulniers planned changes to this revision.Dec 19 2022, 2:31 PM
nickdesaulniers added inline comments.
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
179–180

oh, if I remove it, I get the same result from llc -print-before-all.

nickdesaulniers marked 2 inline comments as done.
  • drop getPassName() override
This revision is now accepted and ready to land.Dec 19 2022, 2:34 PM
Matt added a subscriber: Matt.Dec 19 2022, 5:09 PM
This revision was landed with ongoing or failed builds.Dec 20 2022, 2:17 PM
This revision was automatically updated to reflect the committed changes.