On windows if the frame size exceed 4096 bytes, compiler need to generate a call to _alloca_probe. X86CallFrameOptimization pass changes the reserved stack size and cause of stack probe function not be inserted. This patch fix the issue by detecting the call frame size, if the size exceed 4096 bytes, drop X86CallFrameOptimization.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Seems reasonable, but I have some suggestions.
llvm/lib/Target/X86/X86CallFrameOptimization.cpp | ||
---|---|---|
247–254 ↗ | (On Diff #214056) | I see this pattern for calculating the stack probe size is already duplicated twice. Please factor it out into a method of X86ISelLowering, perhaps next to getStackProbeSymbolName and update the two callers along with this one. |
258–261 ↗ | (On Diff #214056) | I see that TargetInstrInfo uses the phrase "frame size" to refer to the size of the arguments used to pass call arguments, but I think that's easily confused with the size of the current function's stack frame. Maybe this comment would be clearer: If any call allocates more argument stack memory than the stack probe size, don't do this optimization. Otherwise, this pass would need to synthesize additional stack probe calls to allocate memory for arguments. |
263 ↗ | (On Diff #214056) | Please move this check into the isLegal method where other preconditions are checked. |