[Mlir-commits] [mlir] [MLIR][EmitC] Fix crash in SwitchOp::getEntrySuccessorRegions on unsigned integer type (PR #188546)
Gil Rapaport
llvmlistbot at llvm.org
Thu Mar 26 02:46:44 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());
----------------
aniragil wrote:
Can the two instances of this logic be outlined into a function?
https://github.com/llvm/llvm-project/pull/188546
More information about the Mlir-commits
mailing list