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

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 04:13:10 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-spir-v

Author: Vyacheslav Levytskyy (VyacheslavLevytskyy)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/108534.diff


1 Files Affected:

- (modified) llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp (+1-1) 


``````````diff
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)

``````````

</details>


https://github.com/llvm/llvm-project/pull/108534


More information about the llvm-commits mailing list