diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2019-10-30 17:16:55 -0700 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2019-10-30 18:20:37 -0700 |
| commit | f0eeb3c7a7136dd043b792ff2d321ad492db203a (patch) | |
| tree | adad48222bbbabf95a4a3a0d5909729772e50ed9 /llvm/lib | |
| parent | 9baf4958cda4cb7857c62681a5f50200de0a662a (diff) | |
| download | bcm5719-llvm-f0eeb3c7a7136dd043b792ff2d321ad492db203a.tar.gz bcm5719-llvm-f0eeb3c7a7136dd043b792ff2d321ad492db203a.zip | |
[GISel][CombinerHelper] Combine shuffle_vector scalar to build_vector
Teach the combiner helper how to replace shuffle_vector of scalars
into build_vector.
I am not particularly happy about having to add this combine, but we
currently get those from <1 x iN> from the IR.
Bonus: This fixes an assert in the shuffle_vector combines since before
this patch, we were expecting vector types.
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index 854769d283f..bb7f751de90 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -190,7 +190,7 @@ bool CombinerHelper::matchCombineShuffleVector(MachineInstr &MI, Register Src1 = MI.getOperand(1).getReg(); LLT SrcType = MRI.getType(Src1); unsigned DstNumElts = DstType.getNumElements(); - unsigned SrcNumElts = SrcType.getNumElements(); + unsigned SrcNumElts = SrcType.isVector() ? SrcType.getNumElements() : 1; // If the resulting vector is smaller than the size of the source // vectors being concatenated, we won't be able to replace the @@ -254,7 +254,7 @@ void CombinerHelper::applyCombineShuffleVector(MachineInstr &MI, Builder.setInsertPt(*MI.getParent(), MI); Register NewDstReg = MRI.cloneVirtualRegister(DstReg); - Builder.buildConcatVectors(NewDstReg, Ops); + Builder.buildMerge(NewDstReg, Ops); MI.eraseFromParent(); replaceRegWith(MRI, DstReg, NewDstReg); |

