brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 5f3fa94 Raw
87 lines · plain
1; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t12; RUN: llc -mcpu=v1 %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK %s3; RUN: opt -O2 -mtriple=bpf-pc-linux -bpf-disable-avoid-speculation %s | llvm-dis > %t14; RUN: llc -mcpu=v1 %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK-DISABLE %s5;6; Source:7;   unsigned foo();8;   ptr test(ptr p) {9;     unsigned ret = foo();10;     if (ret <= 7)11;       p += ret;12;     return p;13;   }14; Compilation flag:15;   clang -target bpf -O2 -S -emit-llvm -Xclang -disable-llvm-passes test.c16 17; Function Attrs: nounwind18define dso_local ptr @test(ptr %p) {19entry:20  %p.addr = alloca ptr, align 821  %ret = alloca i32, align 422  store ptr %p, ptr %p.addr, align 8, !tbaa !223  call void @llvm.lifetime.start.p0(i64 4, ptr %ret)24  %call = call i32 @foo()25  store i32 %call, ptr %ret, align 4, !tbaa !626  %0 = load i32, ptr %ret, align 4, !tbaa !627  %cmp = icmp ule i32 %0, 728  br i1 %cmp, label %if.then, label %if.end29 30if.then:                                          ; preds = %entry31  %1 = load i32, ptr %ret, align 4, !tbaa !632  %2 = load ptr, ptr %p.addr, align 8, !tbaa !233  %idx.ext = zext i32 %1 to i6434  %add.ptr = getelementptr i8, ptr %2, i64 %idx.ext35  store ptr %add.ptr, ptr %p.addr, align 8, !tbaa !236  br label %if.end37 38if.end:                                           ; preds = %if.then, %entry39  %3 = load ptr, ptr %p.addr, align 8, !tbaa !240  call void @llvm.lifetime.end.p0(i64 4, ptr %ret)41  ret ptr %342}43 44; CHECK-COMMON:  [[REG6:r[0-9]+]] = r145; CHECK-COMMON:  call foo46 47; CHECK:         r0 <<= 3248; CHECK:         r0 >>= 3249; CHECK:         if r0 > 7 goto [[LABEL:.*]]50; CHECK:         [[REG6]] += r051; CHECK:         [[LABEL]]:52; CHECK:         r0 = [[REG6]]53 54; CHECK-DISABLE: [[REG1:r[0-9]+]] = r055; CHECK-DISABLE: [[REG1]] <<= 3256; CHECK-DISABLE: [[REG1]] >>= 3257; CHECK-DISABLE: [[REG2:r[0-9]+]] = 858; CHECK-DISABLE: if [[REG2]] > [[REG1]] goto [[LABEL:.*]]59; CHECK-DISABLE: r0 = 060; CHECK-DISABLE: [[LABEL]]:61; CHECK-DISABLE: r0 <<= 3262; CHECK-DISABLE: r0 >>= 3263; CHECK-DISABLE: [[REG6]] += r064; CHECK-DISABLE: r0 = [[REG6]]65 66; CHECK-COMMON:  exit67 68; Function Attrs: argmemonly nounwind willreturn69declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)70 71declare dso_local i32 @foo(...)72 73; Function Attrs: argmemonly nounwind willreturn74declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)75 76!llvm.module.flags = !{!0}77!llvm.ident = !{!1}78 79!0 = !{i32 1, !"wchar_size", i32 4}80!1 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git ca9c5433a6c31e372092fcd8bfd0e4fddd7e8784)"}81!2 = !{!3, !3, i64 0}82!3 = !{!"any pointer", !4, i64 0}83!4 = !{!"omnipotent char", !5, i64 0}84!5 = !{!"Simple C/C++ TBAA"}85!6 = !{!7, !7, i64 0}86!7 = !{!"int", !4, i64 0}87