Skip to content

Commit

Permalink
add test case for CompileTimePropertiesPass
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdi4 committed Feb 16, 2024
1 parent 4b2b904 commit a0597c8
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt -passes=compile-time-properties -S %s -o %t.ll
; RUN: FileCheck %s -input-file=%t.ll
;
; Tests the translation of "sycl-alignment" to alignment attributes on load/store
; Tests the translation of "sycl-alignment" to alignment attributes on load/store/non-memory instructions

target triple = "spir64_fpga-unknown-unknown"

Expand All @@ -11,13 +11,14 @@ target triple = "spir64_fpga-unknown-unknown"
$_ZN7ann_refIiEC2EPi = comdat any
$_ZN7ann_refIiEcvRiEv = comdat any
$_ZN7ann_refIiEC2EPi1= comdat any
$no_load_store = comdat any

@.str = private unnamed_addr addrspace(1) constant [16 x i8] c"sycl-properties\00", section "llvm.metadata"
@.str.1 = private unnamed_addr addrspace(1) constant [9 x i8] c"main.cpp\00", section "llvm.metadata"
@.str.2 = private unnamed_addr addrspace(1) constant [15 x i8] c"sycl-alignment\00", section "llvm.metadata"
@.str.3 = private unnamed_addr addrspace(1) constant [3 x i8] c"64\00", section "llvm.metadata"
@.args = private unnamed_addr addrspace(1) constant { ptr addrspace(1), ptr addrspace(1) } { ptr addrspace(1) @.str.2, ptr addrspace(1) @.str.3 }, section "llvm.met
adata"
@.args = private unnamed_addr addrspace(1) constant { ptr addrspace(1), ptr addrspace(1) } { ptr addrspace(1) @.str.2, ptr addrspace(1) @.str.3 }, section "llvm.metadata"
; CHECK: @[[AnnoStr:.*]] = private unnamed_addr addrspace(1) constant [10 x i8] c"{44:\2264\22}\00"

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
declare ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4), ptr addrspace(1), ptr addrspace(1), i32, ptr addrspace(1)) #5
Expand Down Expand Up @@ -77,4 +78,19 @@ entry:
ret void
}

; Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
define linkonce_odr dso_local spir_func noundef ptr addrspace(4) @no_load_store(ptr addrspace(4) noundef %ptr) comdat align 2 {
entry:
%retval = alloca ptr addrspace(4), align 8
%ptr.addr = alloca ptr addrspace(4), align 8
%retval.ascast = addrspacecast ptr %retval to ptr addrspace(4)
%ptr.addr.ascast = addrspacecast ptr %ptr.addr to ptr addrspace(4)
store ptr addrspace(4) %ptr, ptr addrspace(4) %ptr.addr.ascast, align 8
%0 = load ptr addrspace(4), ptr addrspace(4) %ptr.addr.ascast, align 8
; CHECK: %[[AnnoPtr:.*]] = call ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4) %0, ptr addrspace(1) @[[AnnoStr]]
; CHECK: ret ptr addrspace(4) %[[AnnoPtr]]
%1 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4) %0, ptr addrspace(1) @.str, ptr addrspace(1) @.str.1, i32 73, ptr addrspace(1) @.args)
ret ptr addrspace(4) %1
}

declare void @llvm.memcpy.p4.p4.i32(ptr addrspace(4), ptr addrspace(4), i32, i1)

0 comments on commit a0597c8

Please sign in to comment.