xref: /llvm-project/llvm/test/CodeGen/Generic/ForceStackAlign.ll (revision 23d209f350f4e51b2a42636ce45d10c6e208252d)
1; Check that stack alignment can be forced. Individual targets should test their
2; specific implementation details.
3
4; RUN: llc < %s -stackrealign | FileCheck %s
5; CHECK-LABEL: @f
6; CHECK-LABEL: @g
7
8; NVPTX can only select dynamic_stackalloc on sm_52+ and with ptx73+
9; XFAIL: target=nvptx{{.*}}
10
11define i32 @f(ptr %p) nounwind {
12entry:
13  %0 = load i8, ptr %p
14  %conv = sext i8 %0 to i32
15  ret i32 %conv
16}
17
18define i64 @g(i32 %i) nounwind {
19entry:
20  br label %if.then
21
22if.then:
23  %0 = alloca i8, i32 %i
24  call void @llvm.memset.p0.i32(ptr %0, i8 0, i32 %i, i1 false)
25  %call = call i32 @f(ptr %0)
26  %conv = sext i32 %call to i64
27  ret i64 %conv
28}
29
30declare void @llvm.memset.p0.i32(ptr, i8, i32, i1) nounwind
31
32!llvm.module.flags = !{!0}
33!0 = !{i32 2, !"override-stack-alignment", i32 32}
34