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; CHECK: andl $-16, %esp 21; CHECK: .cv_fpo_stackalign 16 22; CHECK: subl $32, %esp 23; CHECK: .cv_fpo_stackalloc 32 24; CHECK: .cv_fpo_endprologue 25; CHECK: movl %esp, %esi 26; CHECK: leal 8(%esi), 27; CHECK: calll _usethings 28; CHECK: addl $8, %esp 29; CHECK: xorl %eax, %eax 30; CHECK: leal -4(%ebp), %esp 31; CHECK: popl %esi 32; CHECK: popl %ebp 33; CHECK: retl 34; CHECK: .cv_fpo_endproc 35 36 37; ModuleID = 't.c' 38source_filename = "t.c" 39target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 40target triple = "i386-pc-windows-msvc19.11.25508" 41 42; Function Attrs: nounwind 43define i32 @realign_and_alloca(i32 %n) local_unnamed_addr #0 !dbg !8 { 44entry: 45 %d = alloca double, align 8 46 tail call void @llvm.dbg.value(metadata i32 %n, metadata !13, metadata !DIExpression()), !dbg !18 47 %0 = bitcast double* %d to i8*, !dbg !19 48 call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0) #4, !dbg !19 49 tail call void @llvm.dbg.value(metadata double 0.000000e+00, metadata !14, metadata !DIExpression()), !dbg !20 50 store double 0.000000e+00, double* %d, align 8, !dbg !20, !tbaa !21 51 %1 = alloca i8, i32 %n, align 16, !dbg !25 52 tail call void @llvm.dbg.value(metadata i8* %1, metadata !16, metadata !DIExpression()), !dbg !26 53 tail call void @llvm.dbg.value(metadata double* %d, metadata !14, metadata !DIExpression()), !dbg !20 54 call void @usethings(double* nonnull %d, i8* nonnull %1) #4, !dbg !27 55 call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) #4, !dbg !28 56 ret i32 0, !dbg !29 57} 58 59; Function Attrs: argmemonly nounwind 60declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 61 62declare void @usethings(double*, i8*) local_unnamed_addr #2 63 64; Function Attrs: argmemonly nounwind 65declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 66 67; Function Attrs: nounwind readnone speculatable 68declare void @llvm.dbg.value(metadata, metadata, metadata) #3 69 70attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" } 71attributes #1 = { argmemonly nounwind } 72attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" } 73attributes #3 = { nounwind readnone speculatable } 74attributes #4 = { nounwind } 75 76!llvm.dbg.cu = !{!0} 77!llvm.module.flags = !{!3, !4, !5, !6} 78!llvm.ident = !{!7} 79 80!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 81!1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "cfdc2deff5dc50f95e287f877660d4dd") 82!2 = !{} 83!3 = !{i32 1, !"NumRegisterParameters", i32 0} 84!4 = !{i32 2, !"CodeView", i32 1} 85!5 = !{i32 2, !"Debug Info Version", i32 3} 86!6 = !{i32 1, !"wchar_size", i32 2} 87!7 = !{!"clang version 6.0.0 "} 88!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) 89!9 = !DISubroutineType(types: !10) 90!10 = !{!11, !11} 91!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 92!12 = !{!13, !14, !16} 93!13 = !DILocalVariable(name: "n", arg: 1, scope: !8, file: !1, line: 2, type: !11) 94!14 = !DILocalVariable(name: "d", scope: !8, file: !1, line: 3, type: !15) 95!15 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float) 96!16 = !DILocalVariable(name: "p", scope: !8, file: !1, line: 4, type: !17) 97!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 32) 98!18 = !DILocation(line: 2, column: 28, scope: !8) 99!19 = !DILocation(line: 3, column: 3, scope: !8) 100!20 = !DILocation(line: 3, column: 10, scope: !8) 101!21 = !{!22, !22, i64 0} 102!22 = !{!"double", !23, i64 0} 103!23 = !{!"omnipotent char", !24, i64 0} 104!24 = !{!"Simple C/C++ TBAA"} 105!25 = !DILocation(line: 4, column: 13, scope: !8) 106!26 = !DILocation(line: 4, column: 9, scope: !8) 107!27 = !DILocation(line: 5, column: 3, scope: !8) 108!28 = !DILocation(line: 7, column: 1, scope: !8) 109!29 = !DILocation(line: 6, column: 3, scope: !8) 110