[llvm] [SPIRV] Audit `select` Result in SPIRVInstructionSelector (PR #115193)

Sarah Spall via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 14:52:01 PST 2024


================
@@ -1068,30 +1073,34 @@ bool SPIRVInstructionSelector::selectAtomicRMW(Register ResVReg,
                                                MachineInstr &I,
                                                unsigned NewOpcode,
                                                unsigned NegateOpcode) const {
+  bool Result = true;
   assert(I.hasOneMemOperand());
   const MachineMemOperand *MemOp = *I.memoperands_begin();
   uint32_t Scope = static_cast<uint32_t>(getMemScope(
       GR.CurMF->getFunction().getContext(), MemOp->getSyncScopeID()));
-  Register ScopeReg = buildI32Constant(Scope, I);
+  auto ScopeConstant = buildI32Constant(Scope, I);
+  Register ScopeReg = ScopeConstant.first;
+  Result &= ScopeConstant.second;
----------------
spall wrote:

I would again declare Result here

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


More information about the llvm-commits mailing list