This is an archive of the discontinued LLVM Phabricator instance.

MachineIRBuilder: Add buildMergeValues. NFC
ClosedPublic

Authored by rovka on Jan 10 2023, 4:25 AM.

Details

Summary

Add a buildMergeValues method that unconditionally builds a
G_MERGE_VALUES instruction, as opposed to buildMergeLikeOp which may
decide on a different opcode based on the input types.

I haven't audited all the uses of buildMergeLikeOp to see if they can
be replaced with buildMergeValues, but I did find a couple of obvious
ones where we check that we're merging scalars right before calling
buildMerge.

This is a follow-up suggested in https://reviews.llvm.org/D140964

Diff Detail

Event Timeline

rovka created this revision.Jan 10 2023, 4:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 4:25 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
rovka requested review of this revision.Jan 10 2023, 4:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 4:25 AM
rovka added reviewers: Restricted Project, paquette, aemerson.Jan 10 2023, 4:29 AM
foad accepted this revision.Jan 10 2023, 4:31 AM
foad added a subscriber: foad.

LGTM, thanks!

llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp
366

Call it BuildMergeValues?

This revision is now accepted and ready to land.Jan 10 2023, 4:31 AM
rovka added inline comments.Jan 10 2023, 4:35 AM
llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp
366

Of course, good catch :)

arsenm accepted this revision.Jan 10 2023, 5:34 AM
This revision was landed with ongoing or failed builds.Jan 13 2023, 12:45 AM
This revision was automatically updated to reflect the committed changes.