[clang] [llvm] [HLSL][DXIL][SPIRV] Added DeviceMemoryBarrier() and AllMemoryBarrier() intrinsics (PR #190633)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 11:08:32 PDT 2026


================
@@ -2928,18 +2928,19 @@ bool SPIRVInstructionSelector::selectBarrierInst(MachineInstr &I,
          "Device Scope must set UniformMemory and ImageMemory semantic "
          "in Barrier instruction");
 
-  Register MemSemReg = buildI32Constant(MemSem, I);
-  Register ScopeReg = buildI32Constant(Scope, I);
   MachineBasicBlock &BB = *I.getParent();
-  auto MI =
-      BuildMI(BB, I, I.getDebugLoc(), TII.get(BarrierType)).addUse(ScopeReg);
+  auto MI = BuildMI(BB, I, I.getDebugLoc(), TII.get(BarrierType));
 
   // OpControlBarrier needs to also set Execution Scope
   if (WithGroupSync) {
-    MI.addUse(ScopeReg);
+    Register ExecReg = buildI32Constant(SPIRV::Scope::Workgroup, I);
+    MI.addUse(ExecReg);
----------------
bob80905 wrote:

Hmm, we were re-adding the ScopeReg as a use when it was already added! Looks like a bug to me, thanks for catching this.

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


More information about the cfe-commits mailing list