This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] NFC target dependent requiresUniformRegister refactored out
Needs RevisionPublic

Authored by alex-t on Nov 11 2019, 8:02 AM.

Details

Summary

Target specific method encapsulated into the Target Lowering Info.

Diff Detail

Event Timeline

alex-t created this revision.Nov 11 2019, 8:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2019, 8:02 AM
rampitec added inline comments.Nov 11 2019, 12:03 PM
llvm/include/llvm/CodeGen/TargetLowering.h
709

Typo: Divergent Analysis -> Divergence Analysis

llvm/lib/Target/AMDGPU/SIISelLowering.h
408

Formatting is off.

alex-t updated this revision to Diff 228881.Nov 12 2019, 6:22 AM

Typo and formatting fixed.

alex-t marked 2 inline comments as done.Nov 12 2019, 6:23 AM
This revision is now accepted and ready to land.Nov 12 2019, 9:16 AM
arsenm requested changes to this revision.May 26 2020, 9:56 AM
arsenm added inline comments.
llvm/include/llvm/CodeGen/TargetLowering.h
31

No reason to spread this to generic code

llvm/lib/Target/AMDGPU/SIISelLowering.cpp
10975–10976

requiresUniformRegister is an expensive check (which really should be eliminated entirely), so should be made second only when really necessary

This revision now requires changes to proceed.May 26 2020, 9:56 AM
arsenm added inline comments.May 26 2020, 9:59 AM
llvm/include/llvm/CodeGen/TargetLowering.h
712

The DA check could have skipped the virtual call

I've reverted this in 9786e7552d5564268484357866088d0a054bccaf. This will only hurt compile time for what's really an AMDGPU only hack

This revision was not accepted when it landed; it landed in state Needs Revision.May 26 2020, 10:17 AM
This revision was automatically updated to reflect the committed changes.
alex-t marked 2 inline comments as done.May 26 2020, 10:30 AM
alex-t added inline comments.
llvm/include/llvm/CodeGen/TargetLowering.h
31

Why? LegacyDivergenceAnalysis.h is quite generic - not AMDGPU specific

712

Could you explain how it could happen? Any target with no divergent instructions have DA set to nullptr and method returns false.

alex-t reopened this revision.May 26 2020, 10:31 AM
arsenm added inline comments.May 26 2020, 10:53 AM
llvm/include/llvm/CodeGen/TargetLowering.h
712

There's no real reason to call isDivergent if DA is false. The hook should probably take a reference. You also don't need to include the header to TargetLowering (which is widely included), and cuold sink that into the implementation file

llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
382–383

This should avoid all calls with no DA available

llvm/lib/Target/AMDGPU/SIISelLowering.cpp
10975–10976

This part is quite important, I had to fix some really bad compile time regressions a few months ago because requiresUniformRegister is extremely slow

arsenm requested changes to this revision.Jul 6 2020, 12:53 PM
This revision now requires changes to proceed.Jul 6 2020, 12:53 PM