[MachineIRBuilder] Fix an assertion failure with buildMerge
authorQuentin Colombet <quentin.colombet@gmail.com>
Fri, 11 Oct 2019 20:22:47 +0000 (20:22 +0000)
committerQuentin Colombet <quentin.colombet@gmail.com>
Fri, 11 Oct 2019 20:22:47 +0000 (20:22 +0000)
commit7720f1149867ac11543470a945438df59dcd2824
tree0992aff2a7de7430d54b5e7dc7ca4a881a51b83c
parent03fbde6d84704e32eef204c1e59a2c26350aacde
[MachineIRBuilder] Fix an assertion failure with buildMerge

Teach buildMerge how to deal with scalar to vector kind of requests.

Prior to this patch, buildMerge would issue either a G_MERGE_VALUES
when all the vregs are scalars or a G_CONCAT_VECTORS when the destination
vreg is a vector.
G_CONCAT_VECTORS was actually not the proper instruction when the source
vregs were scalars and the compiler would assert that the sources must
be vectors. Instead we want is to issue a G_BUILD_VECTOR when we are
in this situation.

This patch fixes that.

llvm-svn: 374588
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp