[llvm] [SPIRV] Add write to image buffer for shaders. (PR #115927)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 06:59:15 PST 2024


================
@@ -2971,6 +2977,23 @@ void SPIRVInstructionSelector::extractSubvector(
     MIB.addUse(ComponentReg);
 }
 
+void SPIRVInstructionSelector::selectImageWriteIntrinsic(
+    MachineInstr &I) const {
+  // If the load of the image is in a different basic block, then
+  // this will generate invalid code. A proper solution is to move
+  // the OpLoad from selectHandleFromBinding here. However, to do
+  // that we will need to change the return type of the intrinsic.
+  // We will do that when we can, but for now trying to move forward with other
+  // issues.
+  Register DataReg = I.getOperand(3).getReg();
----------------
Keenuts wrote:

Add another `assert(MRI->getVRegDef(ImageReg)->getParent() == I.getParent() &&
"The image must be loaded in the same basic block as its use.");` like in the read version?

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


More information about the llvm-commits mailing list