[llvm] 08f5f6d - [SPIR-V] Fix incorrect emission of G_SPLAT_VECTOR for fixed vectors (#108534)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 00:22:34 PDT 2024


Author: Vyacheslav Levytskyy
Date: 2024-09-18T09:22:30+02:00
New Revision: 08f5f6dc8b09c702125e57a5e87ba56203de6263

URL: https://github.com/llvm/llvm-project/commit/08f5f6dc8b09c702125e57a5e87ba56203de6263
DIFF: https://github.com/llvm/llvm-project/commit/08f5f6dc8b09c702125e57a5e87ba56203de6263.diff

LOG: [SPIR-V] Fix incorrect emission of G_SPLAT_VECTOR for fixed vectors (#108534)

This PR replaces MIRBuilder.buildSplatVector() by
MIRBuilder.buildSplatBuildVector(), so that we emit G_BUILD_VECTOR
instead of G_SPLAT_VECTOR: the latter is incorrect for fixed vectors and
is limited to scalable vectors only.

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index 553d86efa3df34..ca3e47a4b78f23 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -496,7 +496,7 @@ Register SPIRVGlobalRegistry::getOrCreateIntCompositeOrNull(
     assignSPIRVTypeToVReg(SpvType, SpvVecConst, *CurMF);
     DT.add(CA, CurMF, SpvVecConst);
     if (EmitIR) {
-      MIRBuilder.buildSplatVector(SpvVecConst, SpvScalConst);
+      MIRBuilder.buildSplatBuildVector(SpvVecConst, SpvScalConst);
     } else {
       if (Val) {
         auto MIB = MIRBuilder.buildInstr(SPIRV::OpConstantComposite)


        


More information about the llvm-commits mailing list