Perform the probing in the *cough* correct direction.
Related to https://github.com/rust-lang/rust/pull/77885#issuecomment-711062924
Paths
| Differential D90216
[stack-clash] Fix probing of dynamic alloca ClosedPublic Authored by serge-sans-paille on Oct 27 2020, 3:17 AM.
Details
Summary Perform the probing in the *cough* correct direction. Related to https://github.com/rust-lang/rust/pull/77885#issuecomment-711062924
Diff Detail Event TimelineComment Actions I tried the C reproducer from that Rust bug, and it turns out that alloca(0) was already fixed by D88548. But if I change that to a larger size, then it was skipping right over the probe loop. I confirmed that your change here does make it go through the loop. It would be nice to have tests that actually execute this stuff, rather than just relying on manual reviews of the expected assembly, but I don't know if that's feasible in the current infrastructure.
This revision is now accepted and ready to land.Oct 28 2020, 1:49 PM Closed by commit rG0f60bcc36c34: [stack-clash] Fix probing of dynamic alloca (authored by serge-sans-paille). · Explain WhyOct 30 2020, 7:34 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 300933 llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/stack-clash-dynamic-alloca.ll
llvm/test/CodeGen/X86/stack-clash-small-alloc-medium-align.ll
|
Shouldn't this sub before mov 0? I think right now, the first iteration is going to clobber the most recent thing on the stack, in this case the saved value from pushq %rbp.