MachineIRBuilder: Add buildMergeValues. NFC
authorDiana Picus <Diana-Magda.Picus@amd.com>
Mon, 9 Jan 2023 08:21:41 +0000 (09:21 +0100)
committerDiana Picus <Diana-Magda.Picus@amd.com>
Fri, 13 Jan 2023 08:32:58 +0000 (09:32 +0100)
commit2004ab422a01b24c183f958b10ec4845aeb9b453
tree405e1cb44eec85a6cc6ff4df8e25161f56d79f38
parentf95a5fbe7ce1ddc890868a2b4720b4561af672cf
MachineIRBuilder: Add buildMergeValues. NFC

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

I haven't audited all the uses of `buildMergeLikeInstr` 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

Differential Revision: https://reviews.llvm.org/D141373
llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp