xref: /llvm-project/llvm/test/CodeGen/BPF/warn-call.ll (revision c5037db4acd95790a0ca5061c8fa79c5c291607e)
1; RUN: not llc -mtriple=bpfel < %s 2>&1 >/dev/null | FileCheck %s
2
3; CHECK: error: warn_call.c
4; CHECK: built-in function 'memcpy'
5define ptr @warn(ptr returned, ptr, i64) local_unnamed_addr #0 !dbg !6 {
6  tail call void @llvm.dbg.value(metadata ptr %0, i64 0, metadata !14, metadata !17), !dbg !18
7  tail call void @llvm.dbg.value(metadata ptr %1, i64 0, metadata !15, metadata !17), !dbg !19
8  tail call void @llvm.dbg.value(metadata i64 %2, i64 0, metadata !16, metadata !17), !dbg !20
9  tail call void @llvm.memcpy.p0.p0.i64(ptr %0, ptr %1, i64 %2, i1 false), !dbg !21
10  %4 = tail call ptr @foo(ptr %0, ptr %1, i64 %2) #5, !dbg !22
11  %5 = tail call fastcc ptr @bar(ptr %0), !dbg !23
12  ret ptr %5, !dbg !24
13}
14
15; Function Attrs: argmemonly nounwind
16declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #1
17
18declare ptr @foo(ptr, ptr, i64) local_unnamed_addr #2
19
20; Function Attrs: noinline nounwind readnone
21define internal fastcc ptr @bar(ptr readnone returned) unnamed_addr #3 !dbg !25 {
22  tail call void @llvm.dbg.value(metadata ptr null, i64 0, metadata !28, metadata !17), !dbg !30
23  tail call void @llvm.dbg.value(metadata i64 0, i64 0, metadata !29, metadata !17), !dbg !31
24  ret ptr %0, !dbg !32
25}
26
27; Function Attrs: nounwind readnone
28declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #4
29
30!llvm.dbg.cu = !{!0}
31!llvm.module.flags = !{!3, !4}
32!llvm.ident = !{!5}
33
34!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 (trunk 292174) (llvm/trunk 292179)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
35!1 = !DIFile(filename: "warn_call.c", directory: "/w/llvm/bld")
36!2 = !{}
37!3 = !{i32 2, !"Dwarf Version", i32 4}
38!4 = !{i32 2, !"Debug Info Version", i32 3}
39!5 = !{!"clang version 5.0.0 (trunk 292174) (llvm/trunk 292179)"}
40!6 = distinct !DISubprogram(name: "warn", scope: !1, file: !1, line: 4, type: !7, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !13)
41!7 = !DISubroutineType(types: !8)
42!8 = !{!9, !9, !10, !12}
43!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
44!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
45!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: null)
46!12 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
47!13 = !{!14, !15, !16}
48!14 = !DILocalVariable(name: "dst", arg: 1, scope: !6, file: !1, line: 4, type: !9)
49!15 = !DILocalVariable(name: "src", arg: 2, scope: !6, file: !1, line: 4, type: !10)
50!16 = !DILocalVariable(name: "len", arg: 3, scope: !6, file: !1, line: 4, type: !12)
51!17 = !DIExpression()
52!18 = !DILocation(line: 4, column: 18, scope: !6)
53!19 = !DILocation(line: 4, column: 35, scope: !6)
54!20 = !DILocation(line: 4, column: 54, scope: !6)
55!21 = !DILocation(line: 6, column: 2, scope: !6)
56!22 = !DILocation(line: 7, column: 2, scope: !6)
57!23 = !DILocation(line: 8, column: 9, scope: !6)
58!24 = !DILocation(line: 8, column: 2, scope: !6)
59!25 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !7, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !26)
60!26 = !{!27, !28, !29}
61!27 = !DILocalVariable(name: "dst", arg: 1, scope: !25, file: !1, line: 2, type: !9)
62!28 = !DILocalVariable(name: "src", arg: 2, scope: !25, file: !1, line: 2, type: !10)
63!29 = !DILocalVariable(name: "len", arg: 3, scope: !25, file: !1, line: 2, type: !12)
64!30 = !DILocation(line: 2, column: 67, scope: !25)
65!31 = !DILocation(line: 2, column: 86, scope: !25)
66!32 = !DILocation(line: 2, column: 93, scope: !25)
67