[PATCH] Fix hardcoded stack probe space

Andrew H clangbugs.10.mdwxzxkl at spamgourmet.com
Thu Dec 25 21:39:22 PST 2014


> Well, we need a command line flag at the clang level. I don't see why we would need one at the LLVM level because clang can translate the /Gs value into a function attribute.


This revision has now those command line flags removed. Furthermore, the stackprobesize(n) function attribute is only added iff clang has received an overriding flag (specified via -stack-probe-size=n or /Gsn).

If LLVM generates code in the X86 target, is uses the default stack probe size if the function has no stackprobesize(n) function attribute, otherwise it uses the stack probe size of n.

> Sure, but MSVC also supports LTO (under the name LTCG). I'd imagine that they have some sort of behavior when a function with probe size X gets inlined into a function with probe size Y. My guess would be that they'd just take the max of the two functions.


Unfortunately, I must admit that I do not see myself capable of that task, as I am pretty unfamiliar with LTO in LLVM. This revision implements /Gs when LTO is not used, and shows the same behavior for code generation as before when LTO is used. Can this or a later revision be accepted with such a behavior? That would of course only be a partial fix for the initial bug report, but I think would be useful nonetheless.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6684

Files:
  include/llvm-c/Core.h
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/Attributes.h
  include/llvm/Target/TargetFrameLowering.h
  include/llvm/Target/TargetOptions.h
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLParser.h
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/AttributeImpl.h
  lib/IR/Attributes.cpp
  lib/IR/Verifier.cpp
  lib/Target/CppBackend/CPPBackend.cpp
  lib/Target/Hexagon/HexagonFrameLowering.h
  lib/Target/NVPTX/NVPTXFrameLowering.cpp
  lib/Target/PowerPC/PPCFrameLowering.cpp
  lib/Target/X86/X86FrameLowering.cpp
  lib/Target/X86/X86FrameLowering.h
  lib/Target/X86/X86Subtarget.cpp
  lib/Target/X86/X86Subtarget.h
  lib/Target/XCore/XCoreFrameLowering.cpp
  test/CodeGen/X86/stack-probe-size.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6684.17634.patch
Type: text/x-patch
Size: 31399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141226/0339c7f8/attachment.bin>


More information about the llvm-commits mailing list