From: Reid Kleckner Date: Thu, 10 Apr 2014 22:59:13 +0000 (+0000) Subject: Update Clang for LLVM split stack API changes in r205997 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f31150259598511e7b061eb48758c2a64f02ffb3;p=clang Update Clang for LLVM split stack API changes in r205997 Patch by Alex Crichton! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205998 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 17f5f4d633..f0b3cdc50a 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -491,7 +491,6 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { Options.DisableTailCalls = CodeGenOpts.DisableTailCalls; Options.TrapFuncName = CodeGenOpts.TrapFuncName; Options.PositionIndependentExecutable = LangOpts.PIELevel != 0; - Options.EnableSegmentedStacks = CodeGenOpts.EnableSegmentedStacks; TargetMachine *TM = TheTarget->createTargetMachine(Triple, TargetOpts.CPU, FeaturesStr, Options, diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index ca8b99a3cb..e82b6defa6 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1090,6 +1090,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, FuncAttrs.addAttribute(llvm::Attribute::NoRedZone); if (CodeGenOpts.NoImplicitFloat) FuncAttrs.addAttribute(llvm::Attribute::NoImplicitFloat); + if (CodeGenOpts.EnableSegmentedStacks) + FuncAttrs.addAttribute("split-stack"); if (AttrOnCallSite) { // Attributes that should go on the call site only. diff --git a/test/CodeGen/split-stacks.c b/test/CodeGen/split-stacks.c new file mode 100644 index 0000000000..98112467a5 --- /dev/null +++ b/test/CodeGen/split-stacks.c @@ -0,0 +1,18 @@ +// RUN: %clang -target x86_64-linux-gnu -fsplit-stack -S %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-SEGSTK %s +// RUN: %clang -target x86_64-linux-gnu -S %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-NOSEGSTK %s + +int foo() { + return 0; +} + +int main() { + return foo(); +} + +// CHECK-SEGSTK: define i32 @foo() #0 { +// CHECK-SEGSTK: define i32 @main() #0 { +// CHECK-SEGSTK: #0 = { {{.*}} "split-stack" {{.*}} } + +// CHECK-NOSEGSTK: define i32 @foo() #0 { +// CHECK-NOSEGSTK: define i32 @main() #0 { +// CHECK-NOSEGSTK-NOT: #0 = { {{.*}} "split-stack" {{.*}} }