brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 2a7685c Raw
115 lines · plain
1; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s2 3; CHECK-DAG: #[[R0:.*]] = #llvm.tbaa_root<id = "Simple C/C++ TBAA">4; CHECK-DAG: #[[D0:.*]] = #llvm.tbaa_type_desc<id = "scalar type", members = {<#[[R0]], 0>}>5; CHECK-DAG: #[[$T0:.*]] = #llvm.tbaa_tag<base_type = #[[D0]], access_type = #[[D0]], offset = 0>6; CHECK-DAG: #[[R1:.*]] = #llvm.tbaa_root<id = "Other language TBAA">7; CHECK-DAG: #[[D1:.*]] = #llvm.tbaa_type_desc<id = "other scalar type", members = {<#[[R1]], 0>}>8; CHECK-DAG: #[[$T1:.*]] = #llvm.tbaa_tag<base_type = #[[D1]], access_type = #[[D1]], offset = 0>9 10; CHECK-LABEL: llvm.func @tbaa111; CHECK:         llvm.store %{{.*}}, %{{.*}} {12; CHECK-SAME:        tbaa = [#[[$T0]]]13; CHECK-SAME:    } : i8, !llvm.ptr14; CHECK:         llvm.store %{{.*}}, %{{.*}} {15; CHECK-SAME:        tbaa = [#[[$T1]]]16; CHECK-SAME:    } : i8, !llvm.ptr17define dso_local void @tbaa1(ptr %0, ptr %1) {18  store i8 1, ptr %0, align 4, !tbaa !019  store i8 1, ptr %1, align 4, !tbaa !320  ret void21}22 23!0 = !{!1, !1, i64 0}24!1 = !{!"scalar type", !2, i64 0}25!2 = !{!"Simple C/C++ TBAA"}26 27!3 = !{!4, !4, i64 0}28!4 = !{!"other scalar type", !5, i64 0}29!5 = !{!"Other language TBAA"}30 31; // -----32 33; CHECK-DAG: #[[R0:.*]] = #llvm.tbaa_root<id = "Simple C/C++ TBAA">34; CHECK-DAG: #[[$T0:.*]] = #llvm.tbaa_tag<base_type = #[[D2:.*]], access_type = #[[D1:.*]], offset = 8>35; CHECK-DAG: #[[D1]] = #llvm.tbaa_type_desc<id = "long long", members = {<#[[D0:.*]], 0>}>36; CHECK-DAG: #[[D0]] = #llvm.tbaa_type_desc<id = "omnipotent char", members = {<#[[R0]], 0>}>37; CHECK-DAG: #[[D2]] = #llvm.tbaa_type_desc<id = "agg2_t", members = {<#[[D1]], 0>, <#[[D1]], 8>}>38; CHECK-DAG: #[[$T1:.*]] = #llvm.tbaa_tag<base_type = #[[D4:.*]], access_type = #[[D3:.*]], offset = 0>39; CHECK-DAG: #[[D3]] = #llvm.tbaa_type_desc<id = "int", members = {<#[[D0]], 0>}>40; CHECK-DAG: #[[D4]] = #llvm.tbaa_type_desc<id = "agg1_t", members = {<#[[D3]], 0>, <#[[D3]], 4>}>41 42; CHECK-LABEL: llvm.func @tbaa243; CHECK:         llvm.load %{{.*}} {44; CHECK-SAME:        tbaa = [#[[$T0]]]45; CHECK-SAME:    } : !llvm.ptr -> i6446; CHECK:         llvm.store %{{.*}}, %{{.*}} {47; CHECK-SAME:        tbaa = [#[[$T1]]]48; CHECK-SAME:    } : i32, !llvm.ptr49%struct.agg2_t = type { i64, i64 }50%struct.agg1_t = type { i32, i32 }51 52define dso_local void @tbaa2(ptr %0, ptr %1) {53  %3 = getelementptr inbounds %struct.agg2_t, ptr %1, i32 0, i32 154  %4 = load i64, ptr %3, align 8, !tbaa !655  %5 = trunc i64 %4 to i3256  %6 = getelementptr inbounds %struct.agg1_t, ptr %0, i32 0, i32 057  store i32 %5, ptr %6, align 4, !tbaa !1158  ret void59}60 61!6 = !{!7, !8, i64 8}62!7 = !{!"agg2_t", !8, i64 0, !8, i64 8}63!8 = !{!"long long", !9, i64 0}64!9 = !{!"omnipotent char", !10, i64 0}65!10 = !{!"Simple C/C++ TBAA"}66!11 = !{!12, !13, i64 0}67!12 = !{!"agg1_t", !13, i64 0, !13, i64 4}68!13 = !{!"int", !9, i64 0}69 70; // -----71 72; CHECK-LABEL: llvm.func @supported_ops73define void @supported_ops(ptr %arg1, float %arg2, i32 %arg3, i32 %arg4) {74  ; CHECK: llvm.load {{.*}}tbaa =75  %1 = load i32, ptr %arg1, !tbaa !076  ; CHECK: llvm.store {{.*}}tbaa =77  store i32 %1, ptr %arg1, !tbaa !078  ; CHECK: llvm.atomicrmw {{.*}}tbaa =79  %2 = atomicrmw fmax ptr %arg1, float %arg2 acquire, !tbaa !080  ; CHECK: llvm.cmpxchg {{.*}}tbaa =81  %3 = cmpxchg ptr %arg1, i32 %arg3, i32 %arg4 monotonic seq_cst, !tbaa !082  ; CHECK: "llvm.intr.memcpy"{{.*}}tbaa =83  call void @llvm.memcpy.p0.p0.i32(ptr %arg1, ptr %arg1, i32 4, i1 false), !tbaa !084  ; CHECK: "llvm.intr.memset"{{.*}}tbaa =85  call void @llvm.memset.p0.i32(ptr %arg1, i8 42, i32 4, i1 false), !tbaa !086  ; CHECK: llvm.call{{.*}}tbaa =87  call void @foo(ptr %arg1), !tbaa !088  ret void89}90 91declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg)92declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg)93declare void @foo(ptr %arg1)94 95!0 = !{!1, !1, i64 0}96!1 = !{!"scalar type", !2, i64 0}97!2 = !{!"Simple C/C++ TBAA"}98 99; // -----100 101; CHECK: #llvm.tbaa_root102; CHECK-NOT: <{{.*}}>103; CHECK: {{[[:space:]]}}104 105define void @nameless_root(ptr %arg1) {106  ; CHECK: llvm.load {{.*}}tbaa =107  %1 = load i32, ptr %arg1, !tbaa !0108  ret void109}110 111!0 = !{!1, !1, i64 0}112!1 = !{!"scalar type", !2, i64 0}113!2 = !{}114 115