Adds support for this flag. There is also another piece for clang (separate review). More info: https://bugs.llvm.org/show_bug.cgi?id=36221
Related: D43108
Differential D43107
Support for the mno-stack-arg-probe flag nruslan on Feb 8 2018, 5:57 PM. Authored by
Details
Adds support for this flag. There is also another piece for clang (separate review). More info: https://bugs.llvm.org/show_bug.cgi?id=36221 Related: D43108
Diff Detail
Event TimelineComment Actions Please upload patch with full context as described here https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface
Comment Actions @craig.topper: Updated the diff. @hans: I responded to the comments and also updated diff for clang with new changes.
Comment Actions
Comment Actions @MatzeB : mstack-probe-size=0 is already used for a different purpose. It basically, if I remember correctly, always forces calls to chkstk regardless of the actual stack usage. Normally that would only happen after 4K. Regarding your second question -- do we really need to have these flags to be mutually-exclusive? They are related but serve a different purpose. stack-probe-size merely changes the default probe size from 4K to the specified value. mstack-arg-probe/mno-stack-arg-probe enables/disables stack probes. If we disable stack probes, their size no longer matters, but we do not necessarily have to prohibit stack-probe-size. So, in fact, I can imagine somebody may even define system-wide alias if they want to override 4K (for whatever reason). Then some Makefile (which is unaware of this alias) may, for example, disable stack probes completely (like in UEFI code case), and we do not necessarily want to prohibit this combination. Comment Actions Added a small change to set max value for StackProbeSize in WinAlloca. This is to (potentially) avoid generating suboptimal code if -mno-stack-arg-probe is specified Comment Actions
Anyway I don't care deeply about this and don't do that much middle-end work anyway so don't wait for my approval and go with what you think is best. Comment Actions
@MatzeB It is useful in cases where you want to perform manual stack probing, i.e. if you don't have an MMU or MPU and compare the requested stack size to some thread-local stack limit on every chkstk call. This is useful for microcontrollers. Comment Actions @hans: I can modify the clang patch to make sure it does not set stack-probe-size for IR if no-stack-arg-probe is set. Do you think, it is necessary? Also, if we want to further have some changes in the IR verifier, please let me know what example(s) I can take a look at. Comment Actions @MatzeB, @hans, @whitequark: Should we go ahead and merge both clang and llvm changes as is? (since they are both approved already). We can add IR checks in a separate commit if you think it is necessary. Comment Actions I don't know whether it's necessary to enforce that the attributes can't be used together, but I don't have a lot of experience in what the IR allows in this regard. I don't really see that setting both flags would cause problems, though it would of course be a little bit redundant. I'm fine with the change as it is. Comment Actions @hans, @craig.topper, @MatzeB: Can someone commit D43108 and D43107 (this) on my behalf? I do not think, I have commit access. Comment Actions @hans: Thanks! Is it already too late to cherry-pick these changes to the upcoming 6.0 version? |