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

Martin Wehking via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 06:13:38 PST 2024


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

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

>From 1ea58b49996a6e0d5253960501ea349b49b309e3 Mon Sep 17 00:00:00 2001
From: Martin Wehking <martin.wehking at codeplay.com>
Date: Wed, 28 Feb 2024 14:06:15 +0000
Subject: [PATCH] Use object directly instead of accessing ArrayRef

Use RegOp directly inside debug code to silence a static analyzer
that warns about accessing it through its ArrayRef wrapper.
---
 llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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());



More information about the llvm-commits mailing list