brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 3c94e0c Raw
60 lines · plain
1; RUN: llc -mtriple=bpfel -mcpu=v1 -o - %s | FileCheck %s2; RUN: llc -mtriple=bpfeb -mcpu=v1 -o - %s | FileCheck %s3; Source code:4;   struct ipv6_key_t {5;     unsigned pid;6;     unsigned __int128 saddr;7;     unsigned short lport;8;   };9;10;   extern void test1(ptr);11;   int test(int pid) {12;     struct ipv6_key_t ipv6_key = {.pid = pid};13;     test1(&ipv6_key);14;     return 0;15;   }16; Compilation flag:17;   clang -target bpf -O2 -S -emit-llvm t.c18 19%struct.ipv6_key_t = type { i32, i128, i16 }20 21; Function Attrs: nounwind22define dso_local i32 @test(i32 %pid) local_unnamed_addr {23entry:24  %ipv6_key = alloca %struct.ipv6_key_t, align 1625  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %ipv6_key)26  call void @llvm.memset.p0.i64(ptr nonnull align 16 dereferenceable(48) %ipv6_key, i8 0, i64 48, i1 false)27  store i32 %pid, ptr %ipv6_key, align 16, !tbaa !228  call void @test1(ptr nonnull %ipv6_key)29  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %ipv6_key)30  ret i32 031}32 33; CHECK-LABEL: test34; CHECK:       *(u64 *)(r10 - 48) = r{{[0-9]+}}35; CHECK:       *(u32 *)(r10 - 48) = r{{[0-9]+}}36 37; Function Attrs: argmemonly nounwind willreturn38declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)39 40; Function Attrs: argmemonly nounwind willreturn writeonly41declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg)42 43declare dso_local void @test1(ptr) local_unnamed_addr44 45; Function Attrs: argmemonly nounwind willreturn46declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)47 48!llvm.module.flags = !{!0}49!llvm.ident = !{!1}50 51!0 = !{i32 1, !"wchar_size", i32 4}52!1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 55fc7a47f8f18f84b44ff16f4e7a420c0a42ddf1)"}53!2 = !{!3, !4, i64 0}54!3 = !{!"ipv6_key_t", !4, i64 0, !7, i64 16, !8, i64 32}55!4 = !{!"int", !5, i64 0}56!5 = !{!"omnipotent char", !6, i64 0}57!6 = !{!"Simple C/C++ TBAA"}58!7 = !{!"__int128", !5, i64 0}59!8 = !{!"short", !5, i64 0}60