This is an archive of the discontinued LLVM Phabricator instance.

[ConstantHoisting] use struct rather than tuple for adjustments
ClosedPublic

Authored by nickdesaulniers on Jul 13 2023, 2:32 PM.

Details

Summary

We pack this info in a tuple just to spread it back out for a function
call. Spreads in C++ are awkward. If I want to add an additional
element to the tuple, I need to add more calls to std::get<> later. Just
use a struct.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: hiraditya. · View Herald Transcript
nickdesaulniers requested review of this revision.Jul 13 2023, 2:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 2:32 PM
void added a comment.Jul 14 2023, 11:47 AM

I'm not familiar with this code, but why not place the information into ConstantUser instead? Or maybe make the struct a private member of ConstantHoistingPass.

  • make UserAdjustment private to ConstantHoistingPass as per @void

I'm not familiar with this code,

Are you still comfortable reviewing simple NFC refactorings?

but why not place the information into ConstantUser instead?

I'm sure it's possible, but this commit is simplying replacing the RebasedUse std::tuple with a dedicated class. We may be able to refactor that further, but that's more than I care to do for this code, as D155237 is more important to me and I wanted to factor these changes out of D155237. Would you prefer such a more involved change though?

Or maybe make the struct a private member of ConstantHoistingPass.

Sure, good idea! Done. PTAL

void accepted this revision.Jul 14 2023, 3:58 PM

Bueno!

This revision is now accepted and ready to land.Jul 14 2023, 3:58 PM
nickdesaulniers planned changes to this revision.Jul 17 2023, 9:38 AM

whoops, I messed up the rebase; MatInsertPt member should go in the child commit; let me fix that up.

This revision is now accepted and ready to land.Jul 17 2023, 9:41 AM