• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2
3; C source:
4; void usethings(double *, void *p);
5; int realign_and_alloca(int n) {
6;   double d = 0;
7;   void *p = __builtin_alloca(n);
8;   usethings(&d, p);
9;   return 0;
10; }
11
12; CHECK: _realign_and_alloca:                    # @realign_and_alloca
13; CHECK:         .cv_fpo_proc    _realign_and_alloca 4
14; CHECK:         pushl   %ebp
15; CHECK:         .cv_fpo_pushreg %ebp
16; CHECK:         movl    %esp, %ebp
17; CHECK:         .cv_fpo_setframe        %ebp
18; CHECK:         pushl   %esi
19; CHECK:         .cv_fpo_pushreg %esi
20;       We don't seem to need to describe this AND because at this point CSRs
21;       are stored relative to EBP, but it's suspicious.
22; CHECK:         andl    $-16, %esp
23; CHECK:         subl    $32, %esp
24; CHECK:         .cv_fpo_stackalloc      32
25; CHECK:         .cv_fpo_endprologue
26; CHECK:         movl    %esp, %esi
27; CHECK:         leal    8(%esi),
28; CHECK:         calll   _usethings
29; CHECK:         addl    $8, %esp
30; CHECK:         xorl    %eax, %eax
31; CHECK:         leal    -4(%ebp), %esp
32; CHECK:         popl    %esi
33; CHECK:         popl    %ebp
34; CHECK:         retl
35; CHECK:         .cv_fpo_endproc
36
37
38; ModuleID = 't.c'
39source_filename = "t.c"
40target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
41target triple = "i386-pc-windows-msvc19.11.25508"
42
43; Function Attrs: nounwind
44define i32 @realign_and_alloca(i32 %n) local_unnamed_addr #0 !dbg !8 {
45entry:
46  %d = alloca double, align 8
47  tail call void @llvm.dbg.value(metadata i32 %n, metadata !13, metadata !DIExpression()), !dbg !18
48  %0 = bitcast double* %d to i8*, !dbg !19
49  call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0) #4, !dbg !19
50  tail call void @llvm.dbg.value(metadata double 0.000000e+00, metadata !14, metadata !DIExpression()), !dbg !20
51  store double 0.000000e+00, double* %d, align 8, !dbg !20, !tbaa !21
52  %1 = alloca i8, i32 %n, align 16, !dbg !25
53  tail call void @llvm.dbg.value(metadata i8* %1, metadata !16, metadata !DIExpression()), !dbg !26
54  tail call void @llvm.dbg.value(metadata double* %d, metadata !14, metadata !DIExpression()), !dbg !20
55  call void @usethings(double* nonnull %d, i8* nonnull %1) #4, !dbg !27
56  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) #4, !dbg !28
57  ret i32 0, !dbg !29
58}
59
60; Function Attrs: argmemonly nounwind
61declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
62
63declare void @usethings(double*, i8*) local_unnamed_addr #2
64
65; Function Attrs: argmemonly nounwind
66declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
67
68; Function Attrs: nounwind readnone speculatable
69declare void @llvm.dbg.value(metadata, metadata, metadata) #3
70
71attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
72attributes #1 = { argmemonly nounwind }
73attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
74attributes #3 = { nounwind readnone speculatable }
75attributes #4 = { nounwind }
76
77!llvm.dbg.cu = !{!0}
78!llvm.module.flags = !{!3, !4, !5, !6}
79!llvm.ident = !{!7}
80
81!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
82!1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "cfdc2deff5dc50f95e287f877660d4dd")
83!2 = !{}
84!3 = !{i32 1, !"NumRegisterParameters", i32 0}
85!4 = !{i32 2, !"CodeView", i32 1}
86!5 = !{i32 2, !"Debug Info Version", i32 3}
87!6 = !{i32 1, !"wchar_size", i32 2}
88!7 = !{!"clang version 6.0.0 "}
89!8 = distinct !DISubprogram(name: "realign_and_alloca", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
90!9 = !DISubroutineType(types: !10)
91!10 = !{!11, !11}
92!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
93!12 = !{!13, !14, !16}
94!13 = !DILocalVariable(name: "n", arg: 1, scope: !8, file: !1, line: 2, type: !11)
95!14 = !DILocalVariable(name: "d", scope: !8, file: !1, line: 3, type: !15)
96!15 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
97!16 = !DILocalVariable(name: "p", scope: !8, file: !1, line: 4, type: !17)
98!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 32)
99!18 = !DILocation(line: 2, column: 28, scope: !8)
100!19 = !DILocation(line: 3, column: 3, scope: !8)
101!20 = !DILocation(line: 3, column: 10, scope: !8)
102!21 = !{!22, !22, i64 0}
103!22 = !{!"double", !23, i64 0}
104!23 = !{!"omnipotent char", !24, i64 0}
105!24 = !{!"Simple C/C++ TBAA"}
106!25 = !DILocation(line: 4, column: 13, scope: !8)
107!26 = !DILocation(line: 4, column: 9, scope: !8)
108!27 = !DILocation(line: 5, column: 3, scope: !8)
109!28 = !DILocation(line: 7, column: 1, scope: !8)
110!29 = !DILocation(line: 6, column: 3, scope: !8)
111