[llvm-branch-commits] [llvm] [AMDGPU] Error out on too long lit() constants (PR #197803)
Jay Foad via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri May 15 00:33:41 PDT 2026
================
@@ -2540,8 +2540,12 @@ void AMDGPUOperand::addLiteralImmOperand(MCInst &Inst, int64_t Val, bool ApplyMo
// truncated to uint32_t), if the target doesn't support 64-bit literals, or
// the lit modifier is explicitly used, we need to truncate it to the 32
// LSBs.
- if (!AsmParser->has64BitLiterals() || Lit == LitModifier::Lit)
+ if (!AsmParser->has64BitLiterals() || Lit == LitModifier::Lit) {
+ if (!isInt<32>(Val) && !isUInt<32>(Val))
+ const_cast<AMDGPUAsmParser *>(AsmParser)->Error(
+ Inst.getLoc(), "invalid literal value");
----------------
jayfoad wrote:
The error message could be more helpful, maybe something like "literal value out of range"?
https://github.com/llvm/llvm-project/pull/197803
More information about the llvm-branch-commits
mailing list