This is an archive of the discontinued LLVM Phabricator instance.

[LoopInfo] SFINAE mechanism for hoist into check
ClosedPublic

Authored by Dinistro on Apr 17 2023, 1:41 AM.

Details

Summary

This commit introduces an SFINAE mechanism to make the LLVM hoist into
check member function not leak into the users of LoopInfo.

Depends on D148235

Diff Detail

Event Timeline

Dinistro created this revision.Apr 17 2023, 1:41 AM
Herald added a project: Restricted Project. · View Herald Transcript
Dinistro updated this revision to Diff 514167.Apr 17 2023, 5:16 AM

fix tests by querying for a non-static member function

Dinistro updated this revision to Diff 514862.Apr 19 2023, 1:37 AM

rebased. CI will still break due to bug in main

Dinistro published this revision for review.Apr 19 2023, 1:38 AM
Dinistro added a reviewer: ftynse.

This is now ready for review. Note that the CI fails because of an unrelated ORC issue, that is present in main as well.

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 19 2023, 1:39 AM
zero9178 added inline comments.Apr 19 2023, 1:48 AM
llvm/include/llvm/Support/GenericLoopInfoImpl.h
185

Somewhat small nit, but this can probably be implemented nicer using if constexpr

template <class BlockT>
bool isLegalToHoistInto(BlockT *Block) {
   if constexpr (detect_has_hoist_check<BlockT>::value)
       return Block->isLegalToHoistInto();
   else
       return false;
}

Less SFINAE magic!

Dinistro updated this revision to Diff 514950.Apr 19 2023, 7:26 AM
Dinistro marked an inline comment as done.

address review comments

Dinistro added inline comments.Apr 19 2023, 7:52 AM
llvm/include/llvm/Support/GenericLoopInfoImpl.h
185

I forgot about the if constexpr construct, thanks for the suggestion.

ftynse accepted this revision.Apr 21 2023, 2:10 PM
This revision is now accepted and ready to land.Apr 21 2023, 2:10 PM
This revision was landed with ongoing or failed builds.Apr 23 2023, 11:25 PM
This revision was automatically updated to reflect the committed changes.