llvm.org GIT mirror llvm / eade763
Move llvm/test/DebugInfo/Generic/safestack-byval.ll to X86. It depends on x86-64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254396 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 4 years ago
2 changed file(s) with 94 addition(s) and 94 deletion(s). Raw diff Collapse all Expand all
+0
-94
test/DebugInfo/Generic/safestack-byval.ll less more
None ; Test dwarf codegen for DILocalVariable of a byval function argument that
1 ; points to neither an argument nor an alloca. This kind of IR is generated by
2 ; SafeStack for unsafe byval arguments.
3 ; RUN: llc -stop-after expand-isel-pseudos %s -o /dev/null | FileCheck %s
4 ; XFAIL: hexagon
5
6 ; This was built by compiling the following source with SafeStack and
7 ; simplifying the result a little.
8 ; struct S {
9 ; int a[100];
10 ; };
11 ;
12 ; int f(S zzz, unsigned long len) {
13 ; return zzz.a[len];
14 ; }
15
16 ; REQUIRES: tls
17
18 ; CHECK: ![[ZZZ:.*]] = !DILocalVariable(name: "zzz",
19 ; CHECK: ![[ZZZ_EXPR:.*]] = !DIExpression(DW_OP_deref, DW_OP_minus, 400)
20 ; CHECK: DBG_VALUE {{.*}} ![[ZZZ]], ![[ZZZ_EXPR]]
21
22 %struct.S = type { [100 x i32] }
23
24 @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
25
26 ; Function Attrs: norecurse nounwind readonly safestack uwtable
27 define i32 @_Z1f1Sm(%struct.S* byval nocapture readonly align 8 %zzz, i64 %len) #0 !dbg !12 {
28 entry:
29 %unsafe_stack_ptr = load i8*, i8** @__safestack_unsafe_stack_ptr, !dbg !22
30 %unsafe_stack_static_top = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400, !dbg !22
31 store i8* %unsafe_stack_static_top, i8** @__safestack_unsafe_stack_ptr, !dbg !22
32 ; !17 describes "zzz"
33 call void @llvm.dbg.declare(metadata i8* %unsafe_stack_ptr, metadata !17, metadata !23), !dbg !22
34 %0 = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400, !dbg !22
35 %zzz.unsafe-byval = bitcast i8* %0 to %struct.S*, !dbg !22
36 %1 = bitcast %struct.S* %zzz to i8*, !dbg !24
37 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 400, i32 8, i1 false), !dbg !24
38 tail call void @llvm.dbg.value(metadata i64 %len, i64 0, metadata !18, metadata !25), !dbg !24
39 %arrayidx = getelementptr inbounds %struct.S, %struct.S* %zzz.unsafe-byval, i64 0, i32 0, i64 %len, !dbg !26
40 %2 = load i32, i32* %arrayidx, align 4, !dbg !26, !tbaa !27
41 store i8* %unsafe_stack_ptr, i8** @__safestack_unsafe_stack_ptr, !dbg !31
42 ret i32 %2, !dbg !31
43 }
44
45 ; Function Attrs: nounwind readnone
46 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
47
48 ; Function Attrs: nounwind readnone
49 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
50
51 ; Function Attrs: argmemonly nounwind
52 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2
53
54 attributes #0 = { norecurse nounwind readonly safestack uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
55 attributes #1 = { nounwind readnone }
56 attributes #2 = { argmemonly nounwind }
57
58 !llvm.dbg.cu = !{!0}
59 !llvm.module.flags = !{!19, !20}
60 !llvm.ident = !{!21}
61
62 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 254107) (llvm/trunk 254109)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !11)
63 !1 = !DIFile(filename: "../llvm/1.cc", directory: "/tmp/build")
64 !2 = !{}
65 !3 = !{!4}
66 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 4, size: 3200, align: 32, elements: !5, identifier: "_ZTS1S")
67 !5 = !{!6}
68 !6 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !"_ZTS1S", file: !1, line: 5, baseType: !7, size: 3200, align: 32)
69 !7 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 3200, align: 32, elements: !9)
70 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
71 !9 = !{!10}
72 !10 = !DISubrange(count: 100)
73 !11 = !{!12}
74 !12 = distinct !DISubprogram(name: "f", linkageName: "_Z1f1Sm", scope: !1, file: !1, line: 8, type: !13, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, variables: !16)
75 !13 = !DISubroutineType(types: !14)
76 !14 = !{!8, !"_ZTS1S", !15}
77 !15 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
78 !16 = !{!17, !18}
79 !17 = !DILocalVariable(name: "zzz", arg: 1, scope: !12, file: !1, line: 8, type: !"_ZTS1S")
80 !18 = !DILocalVariable(name: "len", arg: 2, scope: !12, file: !1, line: 8, type: !15)
81 !19 = !{i32 2, !"Dwarf Version", i32 4}
82 !20 = !{i32 2, !"Debug Info Version", i32 3}
83 !21 = !{!"clang version 3.8.0 (trunk 254107) (llvm/trunk 254109)"}
84 !22 = !DILocation(line: 8, column: 9, scope: !12)
85 !23 = !DIExpression(DW_OP_deref, DW_OP_minus, 400)
86 !24 = !DILocation(line: 8, column: 28, scope: !12)
87 !25 = !DIExpression()
88 !26 = !DILocation(line: 9, column: 10, scope: !12)
89 !27 = !{!28, !28, i64 0}
90 !28 = !{!"int", !29, i64 0}
91 !29 = !{!"omnipotent char", !30, i64 0}
92 !30 = !{!"Simple C/C++ TBAA"}
93 !31 = !DILocation(line: 9, column: 3, scope: !12)
0 ; Test dwarf codegen for DILocalVariable of a byval function argument that
1 ; points to neither an argument nor an alloca. This kind of IR is generated by
2 ; SafeStack for unsafe byval arguments.
3 ; RUN: llc -stop-after expand-isel-pseudos %s -o /dev/null | FileCheck %s
4 ; XFAIL: hexagon
5
6 ; This was built by compiling the following source with SafeStack and
7 ; simplifying the result a little.
8 ; struct S {
9 ; int a[100];
10 ; };
11 ;
12 ; int f(S zzz, unsigned long len) {
13 ; return zzz.a[len];
14 ; }
15
16 ; REQUIRES: tls
17
18 ; CHECK: ![[ZZZ:.*]] = !DILocalVariable(name: "zzz",
19 ; CHECK: ![[ZZZ_EXPR:.*]] = !DIExpression(DW_OP_deref, DW_OP_minus, 400)
20 ; CHECK: DBG_VALUE {{.*}} ![[ZZZ]], ![[ZZZ_EXPR]]
21
22 %struct.S = type { [100 x i32] }
23
24 @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
25
26 ; Function Attrs: norecurse nounwind readonly safestack uwtable
27 define i32 @_Z1f1Sm(%struct.S* byval nocapture readonly align 8 %zzz, i64 %len) #0 !dbg !12 {
28 entry:
29 %unsafe_stack_ptr = load i8*, i8** @__safestack_unsafe_stack_ptr, !dbg !22
30 %unsafe_stack_static_top = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400, !dbg !22
31 store i8* %unsafe_stack_static_top, i8** @__safestack_unsafe_stack_ptr, !dbg !22
32 ; !17 describes "zzz"
33 call void @llvm.dbg.declare(metadata i8* %unsafe_stack_ptr, metadata !17, metadata !23), !dbg !22
34 %0 = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400, !dbg !22
35 %zzz.unsafe-byval = bitcast i8* %0 to %struct.S*, !dbg !22
36 %1 = bitcast %struct.S* %zzz to i8*, !dbg !24
37 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 400, i32 8, i1 false), !dbg !24
38 tail call void @llvm.dbg.value(metadata i64 %len, i64 0, metadata !18, metadata !25), !dbg !24
39 %arrayidx = getelementptr inbounds %struct.S, %struct.S* %zzz.unsafe-byval, i64 0, i32 0, i64 %len, !dbg !26
40 %2 = load i32, i32* %arrayidx, align 4, !dbg !26, !tbaa !27
41 store i8* %unsafe_stack_ptr, i8** @__safestack_unsafe_stack_ptr, !dbg !31
42 ret i32 %2, !dbg !31
43 }
44
45 ; Function Attrs: nounwind readnone
46 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
47
48 ; Function Attrs: nounwind readnone
49 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
50
51 ; Function Attrs: argmemonly nounwind
52 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2
53
54 attributes #0 = { norecurse nounwind readonly safestack uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
55 attributes #1 = { nounwind readnone }
56 attributes #2 = { argmemonly nounwind }
57
58 !llvm.dbg.cu = !{!0}
59 !llvm.module.flags = !{!19, !20}
60 !llvm.ident = !{!21}
61
62 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 254107) (llvm/trunk 254109)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !11)
63 !1 = !DIFile(filename: "../llvm/1.cc", directory: "/tmp/build")
64 !2 = !{}
65 !3 = !{!4}
66 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 4, size: 3200, align: 32, elements: !5, identifier: "_ZTS1S")
67 !5 = !{!6}
68 !6 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !"_ZTS1S", file: !1, line: 5, baseType: !7, size: 3200, align: 32)
69 !7 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 3200, align: 32, elements: !9)
70 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
71 !9 = !{!10}
72 !10 = !DISubrange(count: 100)
73 !11 = !{!12}
74 !12 = distinct !DISubprogram(name: "f", linkageName: "_Z1f1Sm", scope: !1, file: !1, line: 8, type: !13, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, variables: !16)
75 !13 = !DISubroutineType(types: !14)
76 !14 = !{!8, !"_ZTS1S", !15}
77 !15 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
78 !16 = !{!17, !18}
79 !17 = !DILocalVariable(name: "zzz", arg: 1, scope: !12, file: !1, line: 8, type: !"_ZTS1S")
80 !18 = !DILocalVariable(name: "len", arg: 2, scope: !12, file: !1, line: 8, type: !15)
81 !19 = !{i32 2, !"Dwarf Version", i32 4}
82 !20 = !{i32 2, !"Debug Info Version", i32 3}
83 !21 = !{!"clang version 3.8.0 (trunk 254107) (llvm/trunk 254109)"}
84 !22 = !DILocation(line: 8, column: 9, scope: !12)
85 !23 = !DIExpression(DW_OP_deref, DW_OP_minus, 400)
86 !24 = !DILocation(line: 8, column: 28, scope: !12)
87 !25 = !DIExpression()
88 !26 = !DILocation(line: 9, column: 10, scope: !12)
89 !27 = !{!28, !28, i64 0}
90 !28 = !{!"int", !29, i64 0}
91 !29 = !{!"omnipotent char", !30, i64 0}
92 !30 = !{!"Simple C/C++ TBAA"}
93 !31 = !DILocation(line: 9, column: 3, scope: !12)