[llvm] [SPIRV] Let atomic store store pointers (PR #201251)

Nick Sarnie via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 08:23:27 PDT 2026


================
@@ -2073,12 +2073,50 @@ bool SPIRVInstructionSelector::selectAtomicStore(MachineInstr &I) const {
   Register MemSemReg = buildI32Constant(MemSem | StorageClass, I);
 
   MachineIRBuilder MIRBuilder(I);
-  auto AtomicStore = MIRBuilder.buildInstr(SPIRV::OpAtomicStore)
-                         .addUse(Ptr)
-                         .addUse(ScopeReg)
-                         .addUse(MemSemReg)
-                         .addUse(StoreVal);
-  AtomicStore.constrainAllUses(TII, TRI, RBI);
+
+  if (PointeeType.isTypePtr()) {
+    auto PtrSize = GR.getPointerSize();
+    SPIRVTypeInst SpirvType =
+        GR.getOrCreateSPIRVIntegerType(PtrSize, MIRBuilder);
+
+    Register NewVRegVal =
----------------
sarnex wrote:

could we name this like `PtrToUVal` or something?

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


More information about the llvm-commits mailing list