Skip to content

Use object directly instead of accessing ArrayRef #83263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

MartinWehking
Copy link
Contributor

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

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

llvmbot commented Feb 28, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Martin Wehking (MartinWehking)

Changes

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

Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it care?

@MartinWehking
Copy link
Contributor Author

It probably expects an assert over the array size, but that would be of course superfluous.
This change is so minor that it could also be simply discarded if it's too irrelevant.

@arsenm arsenm merged commit dfec4ef into llvm:main Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants