[llvm] [GlobalISel] Fix type mismatch in LegalizerHelper ternary (PR #180865)

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 16:55:28 PST 2026


https://github.com/echristo updated https://github.com/llvm/llvm-project/pull/180865

>From fe6ee53f7c7a1eee74dac5df1e08a976a5276398 Mon Sep 17 00:00:00 2001
From: Eric Christopher <echristo at gmail.com>
Date: Fri, 6 Feb 2026 01:50:06 -0800
Subject: [PATCH] Fix type mismatch in LegalizerHelper ternary

Cast enum literal to unsigned to match variable type and satisfy
GCC -Werror=extra.
---
 llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index e6eec3194b716..4e0a46c1cd04c 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -6327,7 +6327,7 @@ Register LegalizerHelper::buildVariableShiftPart(unsigned Opcode,
   // complete value does. So we use LSHR for the main operand shift in ASHR
   // context.
   unsigned MainOpcode =
-      (Opcode == TargetOpcode::G_ASHR) ? TargetOpcode::G_LSHR : Opcode;
+      (Opcode == TargetOpcode::G_ASHR) ? (unsigned)TargetOpcode::G_LSHR : Opcode;
 
   // Perform the primary shift on the main operand
   Register MainShifted =



More information about the llvm-commits mailing list