[llvm] [X86] Fix 32-bit immediate assertion and convert into backend error (PR #123872)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 22:54:08 PST 2025
================
@@ -965,11 +965,11 @@ X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
}
if (MI.getOperand(FIOperandNum+3).isImm()) {
- // Offset is a 32-bit integer.
- int Imm = (int)(MI.getOperand(FIOperandNum + 3).getImm());
- int Offset = FIOffset + Imm;
- assert((!Is64Bit || isInt<32>((long long)FIOffset + Imm)) &&
- "Requesting 64-bit offset in 32-bit immediate!");
+ int64_t Imm = MI.getOperand(FIOperandNum + 3).getImm();
+ int Offset = FIOffset + (int)Imm;
+ if (!Is64Bit && !isInt<32>((int64_t)FIOffset + Imm))
+ MI.emitGenericError("requesting 64-bit offset in 32-bit immediate: " +
----------------
arsenm wrote:
Avoid using the function name in the message. It should be implied and printed from the debug location of the instruction, and this won't handle anonymous functions correctly
https://github.com/llvm/llvm-project/pull/123872
More information about the llvm-commits
mailing list