brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 4c326fe Raw
78 lines · plain
1; RUN: llc -mtriple=bpfel < %s | FileCheck %s2; RUN: llc -mtriple=bpfel -mcpu=v3 < %s | FileCheck %s3;4; Source code:5;   /* set aligned 4 to minimize the number of loads */6;   struct build_id {7;     unsigned char id[20];8;   } __attribute__((aligned(4)));9;10;   /* try to compute a local build_id */11;   void bar1(ptr);12;13;   /* the global build_id to compare */14;   struct build_id id2;15;16;   int foo()17;   {18;     struct build_id id1;19;20;     bar1(&id1);21;     return __builtin_memcmp(&id1, &id2, sizeof(id1)) == 0;22;   }23; Compilation flags:24;   clang -target bpf -S -O2 t.c -emit-llvm25 26 27%struct.build_id = type { [20 x i8] }28 29@id2 = dso_local global %struct.build_id zeroinitializer, align 430 31; Function Attrs: nounwind32define dso_local i32 @foo() local_unnamed_addr #0 {33entry:34  %id11 = alloca [20 x i8], align 435  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %id11) #436  call void @bar1(ptr noundef nonnull %id11) #437  %call = call i32 @memcmp(ptr noundef nonnull dereferenceable(20) %id11, ptr noundef nonnull dereferenceable(20) @id2, i64 noundef 20) #438  %cmp = icmp eq i32 %call, 039  %conv = zext i1 %cmp to i3240  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %id11) #441  ret i32 %conv42}43 44; CHECK-DAG:   *(u32 *)(r1 + 0)45; CHECK-DAG:   *(u32 *)(r1 + 4)46; CHECK-DAG:   *(u32 *)(r10 - 16)47; CHECK-DAG:   *(u32 *)(r10 - 20)48; CHECK-DAG:   *(u32 *)(r10 - 8)49; CHECK-DAG:   *(u32 *)(r10 - 12)50; CHECK-DAG:   *(u32 *)(r1 + 8)51; CHECK-DAG:   *(u32 *)(r1 + 12)52; CHECK-DAG:   *(u32 *)(r2 + 16)53; CHECK-DAG:   *(u32 *)(r10 - 4)54 55; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn56declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #157 58declare dso_local void @bar1(ptr noundef) local_unnamed_addr #259 60; Function Attrs: argmemonly mustprogress nofree nounwind readonly willreturn61declare dso_local i32 @memcmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #362 63; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn64declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #165 66attributes #0 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }67attributes #1 = { argmemonly mustprogress nofree nosync nounwind willreturn }68attributes #2 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }69attributes #3 = { argmemonly mustprogress nofree nounwind readonly willreturn "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }70attributes #4 = { nounwind }71 72!llvm.module.flags = !{!0, !1}73!llvm.ident = !{!2}74 75!0 = !{i32 1, !"wchar_size", i32 4}76!1 = !{i32 7, !"frame-pointer", i32 2}77!2 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git dea65874b2505f8f5e8e51fd8cad6908feb375ec)"}78