-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Computation of locals' offsets is wrong when stack size exceeds 2G #48911
Labels
Comments
Reproducible as far back as LLVM 7, and as recently as of a2eca31 |
RKSimon
pushed a commit
that referenced
this issue
Mar 27, 2024
For very large stack frames, the offset from the stack pointer to a local can be more than 2^31 which overflows various `int` offsets in the frame lowering code. This patch updates the frame lowering code to calculate the offsets as 64-bit values and resolves the overflows, resulting in the correct codegen for very large frames. Fixes #48911
EugeneZelenko
added
llvm:codegen
mc
Machine (object) code
and removed
backend:X86
labels
Mar 27, 2024
zmodem
added a commit
that referenced
this issue
Aug 21, 2024
…rames (#101840)" This casuses assertion failures targeting 32-bit x86: lib/Target/X86/X86RegisterInfo.cpp:989: virtual bool llvm::X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator, int, unsigned int, RegScavenger *) const: Assertion `(Is64Bit || FitsIn32Bits) && "Requesting 64-bit offset in 32-bit immediate!"' failed. See comment on the PR. > Fix 32-bit integer overflows in the X86 target frame layout when dealing > with frames larger than 4gb. When this occurs, we'll scavenge a scratch > register to be able to hold the correct stack offset for frame locals. > > This completes reapplying #84114. > > Fixes #48911 > Fixes #75944 > Fixes #87154 This reverts commit 0abb779.
cjdb
pushed a commit
to cjdb/llvm-project
that referenced
this issue
Aug 23, 2024
…rames (llvm#101840)" This casuses assertion failures targeting 32-bit x86: lib/Target/X86/X86RegisterInfo.cpp:989: virtual bool llvm::X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator, int, unsigned int, RegScavenger *) const: Assertion `(Is64Bit || FitsIn32Bits) && "Requesting 64-bit offset in 32-bit immediate!"' failed. See comment on the PR. > Fix 32-bit integer overflows in the X86 target frame layout when dealing > with frames larger than 4gb. When this occurs, we'll scavenge a scratch > register to be able to hold the correct stack offset for frame locals. > > This completes reapplying llvm#84114. > > Fixes llvm#48911 > Fixes llvm#75944 > Fixes llvm#87154 This reverts commit 0abb779.
dmpolukhin
pushed a commit
to dmpolukhin/llvm-project
that referenced
this issue
Sep 2, 2024
…rames (llvm#101840)" This casuses assertion failures targeting 32-bit x86: lib/Target/X86/X86RegisterInfo.cpp:989: virtual bool llvm::X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator, int, unsigned int, RegScavenger *) const: Assertion `(Is64Bit || FitsIn32Bits) && "Requesting 64-bit offset in 32-bit immediate!"' failed. See comment on the PR. > Fix 32-bit integer overflows in the X86 target frame layout when dealing > with frames larger than 4gb. When this occurs, we'll scavenge a scratch > register to be able to hold the correct stack offset for frame locals. > > This completes reapplying llvm#84114. > > Fixes llvm#48911 > Fixes llvm#75944 > Fixes llvm#87154 This reverts commit 0abb779.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extended Description
Given the following test case:
Will produce the following assembly:
You will notice that both the variables
alloca
d in this function are considered to be below the already adjusted stack pointer, rather than above it, where they ought to be.This looks like a basic signed 32-bit integer overflow somewhere in prologepilog:
Worth noting that the the
def_cfa_offset
directive also overflowed in this reproducer here.The text was updated successfully, but these errors were encountered: