[llvm] Use object directly instead of accessing ArrayRef (PR #83263)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 06:14:16 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Martin Wehking (MartinWehking)

<details>
<summary>Changes</summary>

Use RegOp directly inside debug code to silence a static analyzer that warns about accessing it through its ArrayRef wrapper.

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


1 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp
index 9dade7442c3566..e2678e8336c569 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp
@@ -2292,7 +2292,7 @@ MachineBasicBlock *AMDGPUMachineCFGStructurizer::createIfRegion(
             MachineOperand::CreateReg(Reg, false, false, true);
         ArrayRef<MachineOperand> Cond(RegOp);
         LLVM_DEBUG(dbgs() << "RegionExitReg: ");
-        LLVM_DEBUG(Cond[0].print(dbgs(), TRI));
+        LLVM_DEBUG(RegOp.print(dbgs(), TRI));
         LLVM_DEBUG(dbgs() << "\n");
         TII->insertBranch(*RegionExit, CurrentRegion->getEntry(), RegionExit,
                           Cond, DebugLoc());

``````````

</details>


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


More information about the llvm-commits mailing list