Skip to content

Commit

Permalink
reland [IR] make -stack-alignment= into a module attr
Browse files Browse the repository at this point in the history
Relands commit 433c8d9 with fixes for
MIPS.

Similar to D102742, specifying the stack alignment via CodegenOpts means
that this flag gets dropped during LTO, unless the command line is
re-specified as a plugin opt. Instead, encode this information as a
module level attribute so that we don't have to expose this llvm
internal flag when linking the Linux kernel with LTO.

Looks like external dependencies might need a fix:
* llvm-hs/llvm-hs#345
* halide/Halide#6079

Link: ClangBuiltLinux/linux#1377

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D103048
  • Loading branch information
nickdesaulniers committed Jun 8, 2021
1 parent ee2a92c commit 3787ee4
Show file tree
Hide file tree
Showing 26 changed files with 211 additions and 137 deletions.
1 change: 0 additions & 1 deletion clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
Options.NoNaNsFPMath = LangOpts.NoHonorNaNs;
Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
Options.UnsafeFPMath = LangOpts.UnsafeFPMath;
Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;

Options.BBSections =
llvm::StringSwitch<llvm::BasicBlockSection>(CodeGenOpts.BBSections)
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,8 @@ void CodeGenModule::Release() {
if (getCodeGenOpts().StackProtectorGuardOffset != INT_MAX)
getModule().setStackProtectorGuardOffset(
getCodeGenOpts().StackProtectorGuardOffset);
if (getCodeGenOpts().StackAlignment)
getModule().setOverrideStackAlignment(getCodeGenOpts().StackAlignment);

getTargetCodeGenInfo().emitTargetMetadata(*this, MangledDeclNames);

Expand Down
3 changes: 3 additions & 0 deletions clang/test/CodeGen/stackrealign-main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - -mstack-alignment=64 %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s --check-prefix=DEFAULT

// CHECK-LABEL: define{{.*}} void @other()
// CHECK: [[OTHER:#[0-9]+]]
Expand All @@ -17,3 +18,5 @@ int main(int argc, char **argv) {
// CHECK-NOT: "stackrealign"
// CHECK: }
// CHECK: attributes [[MAIN]] = { noinline nounwind optnone {{.*}}"stackrealign"{{.*}} }
// CHECK: !{i32 1, !"override-stack-alignment", i32 64}
// DEFAULT-NOT: "override-stack-alignment"
4 changes: 4 additions & 0 deletions llvm/include/llvm/IR/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,10 @@ class Module {
int getStackProtectorGuardOffset() const;
void setStackProtectorGuardOffset(int Offset);

/// Get/set the stack alignment overridden from the default.
unsigned getOverrideStackAlignment() const;
void setOverrideStackAlignment(unsigned Align);

/// @name Utility functions for querying and setting the build SDK version
/// @{

Expand Down
3 changes: 0 additions & 3 deletions llvm/include/llvm/Target/TargetOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ namespace llvm {
/// as their parent function, etc.), using an alternate ABI if necessary.
unsigned GuaranteedTailCallOpt : 1;

/// StackAlignmentOverride - Override default stack alignment for target.
unsigned StackAlignmentOverride = 0;

/// StackSymbolOrdering - When true, this will allow CodeGen to order
/// the local stack symbols (for code size, code locality, or any other
/// heuristics). When false, the local symbols are left in whatever order
Expand Down
7 changes: 0 additions & 7 deletions llvm/lib/CodeGen/CommandFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ CGOPT(bool, DontPlaceZerosInBSS)
CGOPT(bool, EnableGuaranteedTailCallOpt)
CGOPT(bool, DisableTailCalls)
CGOPT(bool, StackSymbolOrdering)
CGOPT(unsigned, OverrideStackAlignment)
CGOPT(bool, StackRealign)
CGOPT(std::string, TrapFuncName)
CGOPT(bool, UseCtors)
Expand Down Expand Up @@ -305,11 +304,6 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
cl::init(true));
CGBINDOPT(StackSymbolOrdering);

static cl::opt<unsigned> OverrideStackAlignment(
"stack-alignment", cl::desc("Override default stack alignment"),
cl::init(0));
CGBINDOPT(OverrideStackAlignment);

static cl::opt<bool> StackRealign(
"stackrealign",
cl::desc("Force align the stack to the minimum alignment"),
Expand Down Expand Up @@ -508,7 +502,6 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.EnableAIXExtendedAltivecABI = getEnableAIXExtendedAltivecABI();
Options.NoZerosInBSS = getDontPlaceZerosInBSS();
Options.GuaranteedTailCallOpt = getEnableGuaranteedTailCallOpt();
Options.StackAlignmentOverride = getOverrideStackAlignment();
Options.StackSymbolOrdering = getStackSymbolOrdering();
Options.UseInitArray = !getUseCtors();
Options.RelaxELFRelocations = getRelaxELFRelocations();
Expand Down
11 changes: 11 additions & 0 deletions llvm/lib/IR/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,17 @@ void Module::setStackProtectorGuardOffset(int Offset) {
addModuleFlag(ModFlagBehavior::Error, "stack-protector-guard-offset", Offset);
}

unsigned Module::getOverrideStackAlignment() const {
Metadata *MD = getModuleFlag("override-stack-alignment");
if (auto *CI = mdconst::dyn_extract_or_null<ConstantInt>(MD))
return CI->getZExtValue();
return 0;
}

void Module::setOverrideStackAlignment(unsigned Align) {
addModuleFlag(ModFlagBehavior::Error, "override-stack-alignment", Align);
}

void Module::setSDKVersion(const VersionTuple &V) {
SmallVector<unsigned, 3> Entries;
Entries.push_back(V.getMajor());
Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/Target/Mips/MipsCallLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,11 @@ bool MipsCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
}

unsigned NextStackOffset = CCInfo.getNextStackOffset();
const TargetFrameLowering *TFL = MF.getSubtarget().getFrameLowering();
unsigned StackAlignment = TFL->getStackAlignment();
unsigned StackAlignment = F.getParent()->getOverrideStackAlignment();
if (!StackAlignment) {
const TargetFrameLowering *TFL = MF.getSubtarget().getFrameLowering();
StackAlignment = TFL->getStackAlignment();
}
NextStackOffset = alignTo(NextStackOffset, StackAlignment);
CallSeqStart.addImm(NextStackOffset).addImm(0);

Expand Down
12 changes: 4 additions & 8 deletions llvm/lib/Target/Mips/MipsTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,11 @@ MipsTargetMachine::MipsTargetMachine(const Target &T, const Triple &TT,
getEffectiveCodeModel(CM, CodeModel::Small), OL),
isLittle(isLittle), TLOF(std::make_unique<MipsTargetObjectFile>()),
ABI(MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions)),
Subtarget(nullptr),
DefaultSubtarget(TT, CPU, FS, isLittle, *this,
MaybeAlign(Options.StackAlignmentOverride)),
Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this, None),
NoMips16Subtarget(TT, CPU, FS.empty() ? "-mips16" : FS.str() + ",-mips16",
isLittle, *this,
MaybeAlign(Options.StackAlignmentOverride)),
isLittle, *this, None),
Mips16Subtarget(TT, CPU, FS.empty() ? "+mips16" : FS.str() + ",+mips16",
isLittle, *this,
MaybeAlign(Options.StackAlignmentOverride)) {
isLittle, *this, None) {
Subtarget = &DefaultSubtarget;
initAsmInfo();

Expand Down Expand Up @@ -197,7 +193,7 @@ MipsTargetMachine::getSubtargetImpl(const Function &F) const {
resetTargetOptions(F);
I = std::make_unique<MipsSubtarget>(
TargetTriple, CPU, FS, isLittle, *this,
MaybeAlign(Options.StackAlignmentOverride));
MaybeAlign(F.getParent()->getOverrideStackAlignment()));
}
return I.get();
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/X86TargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
resetTargetOptions(F);
I = std::make_unique<X86Subtarget>(
TargetTriple, CPU, TuneCPU, FS, *this,
MaybeAlign(Options.StackAlignmentOverride), PreferVectorWidthOverride,
RequiredVectorWidth);
MaybeAlign(F.getParent()->getOverrideStackAlignment()),
PreferVectorWidthOverride, RequiredVectorWidth);
}
return I.get();
}
Expand Down
5 changes: 4 additions & 1 deletion llvm/test/CodeGen/Generic/ForceStackAlign.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Check that stack alignment can be forced. Individual targets should test their
; specific implementation details.

; RUN: llc < %s -stackrealign -stack-alignment=32 | FileCheck %s
; RUN: llc < %s -stackrealign | FileCheck %s
; CHECK-LABEL: @f
; CHECK-LABEL: @g

Expand All @@ -25,3 +25,6 @@ if.then:
}

declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i1) nounwind

!llvm.module.flags = !{!0}
!0 = !{i32 2, !"override-stack-alignment", i32 32}
20 changes: 13 additions & 7 deletions llvm/test/CodeGen/Mips/stack-alignment.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
; RUN: llc -march=mipsel < %s | FileCheck %s -check-prefix=32
; RUN: llc -march=mipsel -stack-alignment=32 < %s | FileCheck %s -check-prefix=A32-32
; RUN: llc -march=mipsel -mattr=+fp64,+mips32r2 < %s | FileCheck %s -check-prefix=32
; RUN: llc -march=mips64el -mcpu=mips3 < %s | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips4 < %s | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips64 -stack-alignment=32 < %s | FileCheck %s -check-prefix=A32-64
; RUN: split-file %s %t
; RUN: cat %t/main.ll %t/_32.ll > %t/32.ll
; RUN: llc -march=mipsel < %t/main.ll | FileCheck %s -check-prefix=32
; RUN: llc -march=mipsel < %t/32.ll | FileCheck %s -check-prefix=A32-32
; RUN: llc -march=mipsel -mattr=+fp64,+mips32r2 < %t/main.ll | FileCheck %s -check-prefix=32
; RUN: llc -march=mips64el -mcpu=mips3 < %t/main.ll | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips4 < %t/main.ll | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips64 < %t/main.ll | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips64 < %t/32.ll | FileCheck %s -check-prefix=A32-64

;--- main.ll
; 32: addiu $sp, $sp, -8
; 64: daddiu $sp, $sp, -16
; A32-32: addiu $sp, $sp, -32
Expand All @@ -17,3 +20,6 @@ entry:
}

attributes #0 = { "frame-pointer"="all" }
;--- _32.ll
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"override-stack-alignment", i32 32}
10 changes: 6 additions & 4 deletions llvm/test/CodeGen/X86/base-pointer-and-cmpxchg.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: llc -mtriple=x86_64-apple-macosx -mattr=+cx16 -x86-use-base-pointer=true -stackrealign -stack-alignment=32 %s -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE --check-prefix=USE_BASE_64 %s
; RUN: llc -mtriple=x86_64-apple-macosx -mattr=+cx16 -x86-use-base-pointer=false -stackrealign -stack-alignment=32 %s -o - | FileCheck --check-prefix=CHECK --check-prefix=DONT_USE_BASE %s
; RUN: llc -mtriple=x86_64-linux-gnux32 -mattr=+cx16 -x86-use-base-pointer=true -stackrealign -stack-alignment=32 %s -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE --check-prefix=USE_BASE_32 %s
; RUN: llc -mtriple=x86_64-linux-gnux32 -mattr=+cx16 -x86-use-base-pointer=false -stackrealign -stack-alignment=32 %s -o - | FileCheck --check-prefix=CHECK --check-prefix=DONT_USE_BASE %s
; RUN: llc -mtriple=x86_64-apple-macosx -mattr=+cx16 -x86-use-base-pointer=true -stackrealign %s -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE --check-prefix=USE_BASE_64 %s
; RUN: llc -mtriple=x86_64-apple-macosx -mattr=+cx16 -x86-use-base-pointer=false -stackrealign %s -o - | FileCheck --check-prefix=CHECK --check-prefix=DONT_USE_BASE %s
; RUN: llc -mtriple=x86_64-linux-gnux32 -mattr=+cx16 -x86-use-base-pointer=true -stackrealign %s -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE --check-prefix=USE_BASE_32 %s
; RUN: llc -mtriple=x86_64-linux-gnux32 -mattr=+cx16 -x86-use-base-pointer=false -stackrealign %s -o - | FileCheck --check-prefix=CHECK --check-prefix=DONT_USE_BASE %s

; This function uses dynamic allocated stack to force the use
; of a frame pointer.
Expand Down Expand Up @@ -49,3 +49,5 @@ tail call void asm sideeffect "nop", "~{rax},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},
store i32 %n, i32* %idx
ret i1 %res
}
!llvm.module.flags = !{!0}
!0 = !{i32 2, !"override-stack-alignment", i32 32}
15 changes: 11 additions & 4 deletions llvm/test/CodeGen/X86/base-pointer-and-mwaitx.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+mwaitx -x86-use-base-pointer=true -stackrealign -stack-alignment=32 %s -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE_64 %s
; RUN: llc -mtriple=x86_64-pc-linux-gnux32 -mattr=+mwaitx -x86-use-base-pointer=true -stackrealign -stack-alignment=32 %s -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE_32 %s
; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+mwaitx -x86-use-base-pointer=true %s -o - | FileCheck --check-prefix=CHECK --check-prefix=NO_BASE_64 %s
; RUN: llc -mtriple=x86_64-pc-linux-gnux32 -mattr=+mwaitx -x86-use-base-pointer=true %s -o - | FileCheck --check-prefix=CHECK --check-prefix=NO_BASE_32 %s
; RUN: split-file %s %t
; RUN: cat %t/main.ll %t/_align32.ll > %t/align32.ll
; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+mwaitx -x86-use-base-pointer=true -stackrealign %t/align32.ll -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE_64 %s
; RUN: llc -mtriple=x86_64-pc-linux-gnux32 -mattr=+mwaitx -x86-use-base-pointer=true -stackrealign %t/align32.ll -o - | FileCheck --check-prefix=CHECK --check-prefix=USE_BASE_32 %s
; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+mwaitx -x86-use-base-pointer=true %t/main.ll -o - | FileCheck --check-prefix=CHECK --check-prefix=NO_BASE_64 %s
; RUN: llc -mtriple=x86_64-pc-linux-gnux32 -mattr=+mwaitx -x86-use-base-pointer=true %t/main.ll -o - | FileCheck --check-prefix=CHECK --check-prefix=NO_BASE_32 %s

;--- main.ll

; This test checks that we save and restore the base pointer (ebx or rbx) in the
; presence of the mwaitx intrinsic which requires to use ebx for one of its
Expand Down Expand Up @@ -208,3 +212,6 @@ if.end:
; NO_BASE_32-NEXT: {{.+$}}

declare void @llvm.x86.mwaitx(i32, i32, i32) nounwind
;--- _align32.ll
!llvm.module.flags = !{!0}
!0 = !{i32 2, !"override-stack-alignment", i32 32}
46 changes: 46 additions & 0 deletions llvm/test/CodeGen/X86/dynamic-allocas-VLAs-stack-align.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
; RUN: llc < %s -stack-symbol-ordering=0 -mcpu=generic -stackrealign -mattr=+avx -mtriple=x86_64-apple-darwin10 | FileCheck %s
; rdar://11496434
declare void @t1_helper(i32*)
declare void @t3_helper(i32*, i32*)

; Test when forcing stack alignment
define i32 @t8() nounwind uwtable {
entry:
%a = alloca i32, align 4
call void @t1_helper(i32* %a) nounwind
%0 = load i32, i32* %a, align 4
%add = add nsw i32 %0, 13
ret i32 %add

; CHECK: _t8
; CHECK: movq %rsp, %rbp
; CHECK: andq $-32, %rsp
; CHECK-NEXT: subq $32, %rsp
; CHECK: movq %rbp, %rsp
; CHECK: popq %rbp
}

; VLAs
define i32 @t9(i64 %sz) nounwind uwtable {
entry:
%a = alloca i32, align 4
%vla = alloca i32, i64 %sz, align 16
call void @t3_helper(i32* %a, i32* %vla) nounwind
%0 = load i32, i32* %a, align 4
%add = add nsw i32 %0, 13
ret i32 %add

; CHECK: _t9
; CHECK: pushq %rbp
; CHECK: movq %rsp, %rbp
; CHECK: pushq %rbx
; CHECK: andq $-32, %rsp
; CHECK: subq $32, %rsp
; CHECK: movq %rsp, %rbx

; CHECK: leaq -8(%rbp), %rsp
; CHECK: popq %rbx
; CHECK: popq %rbp
}
!llvm.module.flags = !{!0}
!0 = !{i32 2, !"override-stack-alignment", i32 32}
42 changes: 0 additions & 42 deletions llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: llc < %s -stack-symbol-ordering=0 -mcpu=generic -mattr=+avx -mtriple=x86_64-apple-darwin10 | FileCheck %s
; RUN: llc < %s -stack-symbol-ordering=0 -mcpu=generic -stackrealign -stack-alignment=32 -mattr=+avx -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=FORCE-ALIGN
; rdar://11496434

; no VLAs or dynamic alignment
Expand Down Expand Up @@ -184,44 +183,3 @@ declare i8* @llvm.stacksave() nounwind
declare void @bar(i32, i32*, %struct.struct_t* byval(%struct.struct_t) align 8)

declare void @llvm.stackrestore(i8*) nounwind


; Test when forcing stack alignment
define i32 @t8() nounwind uwtable {
entry:
%a = alloca i32, align 4
call void @t1_helper(i32* %a) nounwind
%0 = load i32, i32* %a, align 4
%add = add nsw i32 %0, 13
ret i32 %add

; FORCE-ALIGN: _t8
; FORCE-ALIGN: movq %rsp, %rbp
; FORCE-ALIGN: andq $-32, %rsp
; FORCE-ALIGN-NEXT: subq $32, %rsp
; FORCE-ALIGN: movq %rbp, %rsp
; FORCE-ALIGN: popq %rbp
}

; VLAs
define i32 @t9(i64 %sz) nounwind uwtable {
entry:
%a = alloca i32, align 4
%vla = alloca i32, i64 %sz, align 16
call void @t3_helper(i32* %a, i32* %vla) nounwind
%0 = load i32, i32* %a, align 4
%add = add nsw i32 %0, 13
ret i32 %add

; FORCE-ALIGN: _t9
; FORCE-ALIGN: pushq %rbp
; FORCE-ALIGN: movq %rsp, %rbp
; FORCE-ALIGN: pushq %rbx
; FORCE-ALIGN: andq $-32, %rsp
; FORCE-ALIGN: subq $32, %rsp
; FORCE-ALIGN: movq %rsp, %rbx

; FORCE-ALIGN: leaq -8(%rbp), %rsp
; FORCE-ALIGN: popq %rbx
; FORCE-ALIGN: popq %rbp
}
5 changes: 4 additions & 1 deletion llvm/test/CodeGen/X86/force-align-stack-alloca.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; arbitrarily force alignment up to 32-bytes for i386 hoping that this will
; exceed any ABI provisions.
;
; RUN: llc < %s -mcpu=generic -stackrealign -stack-alignment=32 | FileCheck %s
; RUN: llc < %s -mcpu=generic -stackrealign | FileCheck %s

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
target triple = "i386-unknown-linux-gnu"
Expand Down Expand Up @@ -74,3 +74,6 @@ if.then:
}

declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i1) nounwind

!llvm.module.flags = !{!0}
!0 = !{i32 2, !"override-stack-alignment", i32 32}
5 changes: 4 additions & 1 deletion llvm/test/CodeGen/X86/hipe-cc.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -stack-symbol-ordering=0 -tailcallopt -code-model=medium -stack-alignment=4 -mtriple=i686-linux-gnu -mcpu=pentium | FileCheck %s
; RUN: llc < %s -stack-symbol-ordering=0 -tailcallopt -code-model=medium -mtriple=i686-linux-gnu -mcpu=pentium | FileCheck %s

; Check the HiPE calling convention works (x86-32)

Expand Down Expand Up @@ -89,3 +89,6 @@ define cc 11 { i32, i32, i32 } @tailcaller(i32 %hp, i32 %p) nounwind {
@clos = external dso_local constant i32
declare cc 11 void @bar(i32, i32, i32, i32, i32)
declare cc 11 { i32, i32, i32 } @tailcallee(i32, i32, i32, i32, i32, i32)

!llvm.module.flags = !{!3}
!3 = !{i32 2, !"override-stack-alignment", i32 4}
4 changes: 3 additions & 1 deletion llvm/test/CodeGen/X86/hipe-cc64.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -stack-symbol-ordering=0 -tailcallopt -relocation-model=static -code-model=medium -stack-alignment=8 -mtriple=x86_64-linux-gnu -mcpu=opteron | FileCheck %s
; RUN: llc < %s -stack-symbol-ordering=0 -tailcallopt -relocation-model=static -code-model=medium -mtriple=x86_64-linux-gnu -mcpu=opteron | FileCheck %s

; Check the HiPE calling convention works (x86-64)

Expand Down Expand Up @@ -100,3 +100,5 @@ define cc 11 { i64, i64, i64 } @tailcaller(i64 %hp, i64 %p) #0 {
@clos = external constant i64
declare cc 11 void @bar(i64, i64, i64, i64, i64, i64)
declare cc 11 { i64, i64, i64 } @tailcallee(i64, i64, i64, i64, i64, i64, i64)
!llvm.module.flags = !{!3}
!3 = !{i32 2, !"override-stack-alignment", i32 8}

0 comments on commit 3787ee4

Please sign in to comment.