Home | History | Annotate | Download | only in libbcc
      1 ; This test checks that the code doesn't aggressively apply TBAA
      2 ; metadata to temporaries that are passed by pointer to kernels.
      3 
      4 ; RUN: opt -load libbcc.so -kernelexp -inline -tbaa -aa-eval -print-may-aliases -evaluate-aa-metadata < %s -S -o - 2>&1 | FileCheck %s
      5 
      6 ; ModuleID = 'kernel.bc'
      7 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
      8 target triple = "aarch64-none-linux-gnueabi"
      9 
     10 ; Declarations expected by the expansion pass.
     11 declare void @_Z14rsGetElementAt13rs_allocationj()
     12 declare void @_Z14rsGetElementAt13rs_allocationjj()
     13 declare void @_Z14rsGetElementAt13rs_allocationjjj()
     14 declare void @_Z14rsSetElementAt13rs_allocationPvj()
     15 declare void @_Z14rsSetElementAt13rs_allocationPvjj()
     16 declare void @_Z14rsSetElementAt13rs_allocationPvjjj()
     17 declare void @_Z25rsGetElementAtYuv_uchar_Y13rs_allocationjj()
     18 declare void @_Z25rsGetElementAtYuv_uchar_U13rs_allocationjj()
     19 declare void @_Z25rsGetElementAtYuv_uchar_V13rs_allocationjj()
     20 
     21 %struct.int5.0 = type { [5 x i32] }
     22 
     23 ; Function Attrs: nounwind
     24 define void @add1_int5(%struct.int5.0* noalias nocapture sret %agg.result, %struct.int5.0* nocapture %in) #0 {
     25   br label %1
     26 
     27 ; <label>:1                                       ; preds = %1, %0
     28   %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %1 ]
     29   %2 = getelementptr inbounds %struct.int5.0, %struct.int5.0* %in, i64 0, i32 0, i64 %indvars.iv
     30 ; CHECK: MayAlias: %load_from_input{{.*}} <-> store %struct.int5.0 %input, %struct.int5.0* %input_struct_slot
     31   %load_from_input = load i32, i32* %2, align 4, !tbaa !9
     32   %3 = add nsw i32 %load_from_input, 1
     33   store i32 %3, i32* %2, align 4, !tbaa !9
     34   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     35   %exitcond = icmp eq i64 %indvars.iv.next, 5
     36   br i1 %exitcond, label %4, label %1
     37 
     38 ; <label>:4                                       ; preds = %1
     39   %5 = bitcast %struct.int5.0* %agg.result to i8*
     40   %6 = bitcast %struct.int5.0* %in to i8*
     41   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %5, i8* %6, i64 20, i32 4, i1 false), !tbaa.struct !13
     42   ret void
     43 }
     44 
     45 ; Function Attrs: nounwind
     46 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0
     47 
     48 attributes #0 = { nounwind }
     49 
     50 !llvm.ident = !{!0}
     51 !\23pragma = !{!1, !2}
     52 !\23rs_export_foreach_name = !{!3, !4}
     53 !\23rs_export_foreach = !{!5, !6}
     54 !\23rs_export_type = !{!7}
     55 !\25int5 = !{!8}
     56 
     57 !0 = !{!"clang version 3.6 "}
     58 !1 = !{!"version", !"1"}
     59 !2 = !{!"java_package_name", !"foo"}
     60 !3 = !{!"root"}
     61 !4 = !{!"add1_int5"}
     62 !5 = !{!"0"}
     63 !6 = !{!"35"}
     64 !7 = !{!"int5"}
     65 !8 = !{!"data", !"<ConstantArray>"}
     66 !9 = !{!10, !10, i64 0}
     67 !10 = !{!"int", !11, i64 0}
     68 !11 = !{!"omnipotent char", !12, i64 0}
     69 !12 = !{!"Simple C/C++ TBAA"}
     70 !13 = !{i64 0, i64 20, !14}
     71 !14 = !{!11, !11, i64 0}
     72