[llvm] 1e353fa - AMDGPU: Fix -Wextra (#138539)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 5 11:02:42 PDT 2025
Author: Matt Arsenault
Date: 2025-05-05T20:02:39+02:00
New Revision: 1e353fa5c3f0e13730cd175a90332b8ab113011d
URL: https://github.com/llvm/llvm-project/commit/1e353fa5c3f0e13730cd175a90332b8ab113011d
DIFF: https://github.com/llvm/llvm-project/commit/1e353fa5c3f0e13730cd175a90332b8ab113011d.diff
LOG: AMDGPU: Fix -Wextra (#138539)
Another stupid gcc warning. Ideally we would directly use the enum type,
but subregister indexes are emitted as an anonymous enum.
Fixes #125548
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
index 9c9b3d5d4f97f..ca7b737f4437c 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
@@ -2521,8 +2521,9 @@ bool AMDGPUInstructionSelector::selectG_TRUNC(MachineInstr &I) const {
return false;
if (SrcSize > 32) {
- unsigned SubRegIdx =
- DstSize < 32 ? AMDGPU::sub0 : TRI.getSubRegFromChannel(0, DstSize / 32);
+ unsigned SubRegIdx = DstSize < 32
+ ? static_cast<unsigned>(AMDGPU::sub0)
+ : TRI.getSubRegFromChannel(0, DstSize / 32);
if (SubRegIdx == AMDGPU::NoSubRegister)
return false;
More information about the llvm-commits
mailing list