[llvm] [X86] Fix 32-bit immediate assertion and convert into backend error (PR #123872)
Wesley Wiser via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 20:59:52 PST 2025
================
@@ -965,11 +965,12 @@ 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: " + MF.getName())
+ .str());
----------------
wesleywiser wrote:
Yeah, we need frame layout to happen so I don't think it can be a verifier error. Fixed those bits you mentioned and added a test based on the IR @abhishek-kaushik22 provided that shows the error being reported for i686 and codegen occurring successfully for x86_64.
https://github.com/llvm/llvm-project/pull/123872
More information about the llvm-commits
mailing list