[Hexagon] Delay emission of CFI instructions
[oota-llvm.git] / test / CodeGen / Hexagon / cfi-late.ll
1 ; RUN: llc -march=hexagon -enable-misched=false < %s | FileCheck %s
2 ; This testcase causes the scheduler to crash for some reason. Disable
3 ; it for now.
4
5 target datalayout = "e-m:e-p:32:32-i64:64-a:0-v32:32-n16:32"
6 target triple = "hexagon-unknown--elf"
7
8 ; Check that allocframe was packetized with the two adds.
9 ; CHECK: foo:
10 ; CHECK: {
11 ; CHECK-DAG: allocframe
12 ; CHECK-DAG: add
13 ; CHECK-DAG: add
14 ; CHECK: }
15 ; CHECK: dealloc_return
16 ; CHECK: }
17
18 ; Function Attrs: nounwind
19 define i32 @foo(i32 %x, i32 %y) #0 {
20 entry:
21   tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !9, metadata !14), !dbg !15
22   tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !10, metadata !14), !dbg !16
23   %add = add nsw i32 %x, 1, !dbg !17
24   %add1 = add nsw i32 %y, 1, !dbg !18
25   %call = tail call i32 @bar(i32 %add, i32 %add1) #3, !dbg !19
26   %add2 = add nsw i32 %call, 1, !dbg !20
27   ret i32 %add2, !dbg !21
28 }
29
30 declare i32 @bar(i32, i32) #1
31
32 ; Function Attrs: nounwind readnone
33 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
34
35 attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv4" "unsafe-fp-math"="false" "use-soft-float"="false" }
36 attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv4" "unsafe-fp-math"="false" "use-soft-float"="false" }
37 attributes #2 = { nounwind readnone }
38 attributes #3 = { nounwind }
39
40 !llvm.dbg.cu = !{!0}
41 !llvm.module.flags = !{!11, !12}
42 !llvm.ident = !{!13}
43
44 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (http://llvm.org/git/clang.git 15506a21305e212c406f980ed9b6b1bac785df56)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
45 !1 = !DIFile(filename: "cfi-late.c", directory: "/test")
46 !2 = !{}
47 !3 = !{!4}
48 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, function: i32 (i32, i32)* @foo, variables: !8)
49 !5 = !DISubroutineType(types: !6)
50 !6 = !{!7, !7, !7}
51 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
52 !8 = !{!9, !10}
53 !9 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !1, line: 3, type: !7)
54 !10 = !DILocalVariable(name: "y", arg: 2, scope: !4, file: !1, line: 3, type: !7)
55 !11 = !{i32 2, !"Dwarf Version", i32 4}
56 !12 = !{i32 2, !"Debug Info Version", i32 3}
57 !13 = !{!"clang version 3.8.0 (http://llvm.org/git/clang.git 15506a21305e212c406f980ed9b6b1bac785df56)"}
58 !14 = !DIExpression()
59 !15 = !DILocation(line: 3, column: 13, scope: !4)
60 !16 = !DILocation(line: 3, column: 20, scope: !4)
61 !17 = !DILocation(line: 4, column: 15, scope: !4)
62 !18 = !DILocation(line: 4, column: 20, scope: !4)
63 !19 = !DILocation(line: 4, column: 10, scope: !4)
64 !20 = !DILocation(line: 4, column: 24, scope: !4)
65 !21 = !DILocation(line: 4, column: 3, scope: !4)