[Mlir-commits] [mlir] [MLIR][EmitC] Fix crash in SwitchOp::getEntrySuccessorRegions on unsigned integer type (PR #188546)

Mehdi Amini llvmlistbot at llvm.org
Thu Mar 26 06:34:46 PDT 2026


================
@@ -1583,8 +1600,24 @@ void SwitchOp::getRegionInvocationBounds(
     return;
   }
 
+  // Compute the integer value of the operand using the appropriate accessor.
+  Type operandType = operandValue.getType();
+  std::optional<int64_t> maybeIntValue;
+  if (operandType.isIndex() || operandType.isSignlessInteger())
+    maybeIntValue = operandValue.getInt();
+  else if (operandType.isSignedInteger())
+    maybeIntValue = operandValue.getSInt();
+  else if (operandType.isUnsignedInteger())
+    maybeIntValue = static_cast<int64_t>(operandValue.getUInt());
----------------
joker-eph wrote:

Done, PTAL

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


More information about the Mlir-commits mailing list