|
| 1 | +; Test that alias scope metadata does not include function names for SPIR-V target. |
| 2 | +; This reduces metadata bloat and improves compilation performance for SYCL. |
| 3 | +; |
| 4 | +; RUN: opt -passes=inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s |
| 5 | + |
| 6 | +; Check that optional string metadata node is not generated. |
| 7 | +; CHECK-NOT: !"callee: %a" |
| 8 | +; CHECK-NOT: !"callee2: %a" |
| 9 | +; CHECK-NOT: !"callee2: %b" |
| 10 | + |
| 11 | +target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 12 | +target triple = "spirv64-unknown-unknown" |
| 13 | + |
| 14 | +define void @callee(ptr noalias nocapture %a, ptr nocapture readonly %c) #0 { |
| 15 | +entry: |
| 16 | + %0 = load float, ptr %c, align 4 |
| 17 | + %arrayidx = getelementptr inbounds float, ptr %a, i64 5 |
| 18 | + store float %0, ptr %arrayidx, align 4 |
| 19 | + ret void |
| 20 | +} |
| 21 | + |
| 22 | +; Don't check correctness precisely - just check if aliasing info is still |
| 23 | +; generated during inlining for SPIR-V target. |
| 24 | +; CHECK-LABEL: caller( |
| 25 | +; CHECK: load float |
| 26 | +; CHECK-SAME: !noalias ![[#Scope1:]] |
| 27 | +; CHECK: store float |
| 28 | +; CHECK-SAME: !alias.scope ![[#Scope1]] |
| 29 | + |
| 30 | +define void @caller(ptr nocapture %a, ptr nocapture readonly %c) #0 { |
| 31 | +entry: |
| 32 | + tail call void @callee(ptr %a, ptr %c) |
| 33 | + %0 = load float, ptr %c, align 4 |
| 34 | + %arrayidx = getelementptr inbounds float, ptr %a, i64 7 |
| 35 | + store float %0, ptr %arrayidx, align 4 |
| 36 | + ret void |
| 37 | +} |
| 38 | + |
| 39 | +define void @callee2(ptr noalias nocapture %a, ptr noalias nocapture %b, ptr nocapture readonly %c) #0 { |
| 40 | +entry: |
| 41 | + %0 = load float, ptr %c, align 4 |
| 42 | + %arrayidx = getelementptr inbounds float, ptr %a, i64 5 |
| 43 | + store float %0, ptr %arrayidx, align 4 |
| 44 | + %arrayidx1 = getelementptr inbounds float, ptr %b, i64 8 |
| 45 | + store float %0, ptr %arrayidx1, align 4 |
| 46 | + ret void |
| 47 | +} |
| 48 | + |
| 49 | +; Don't check correctness precisely - just check if aliasing info is still |
| 50 | +; generated during inlining for SPIR-V target. |
| 51 | +; CHECK-LABEL: caller2( |
| 52 | +; CHECK: load float |
| 53 | +; CHECK-SAME: !noalias ![[#]] |
| 54 | +; CHECK: store float |
| 55 | +; CHECK-SAME: !alias.scope ![[#Scope3:]], !noalias ![[#Scope4:]] |
| 56 | +; CHECK: store float |
| 57 | +; CHECK-SAME: !alias.scope ![[#Scope4:]], !noalias ![[#Scope3:]] |
| 58 | + |
| 59 | +define void @caller2(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 { |
| 60 | +entry: |
| 61 | + tail call void @callee2(ptr %a, ptr %b, ptr %c) |
| 62 | + %0 = load float, ptr %c, align 4 |
| 63 | + %arrayidx = getelementptr inbounds float, ptr %a, i64 7 |
| 64 | + store float %0, ptr %arrayidx, align 4 |
| 65 | + ret void |
| 66 | +} |
| 67 | + |
| 68 | +attributes #0 = { nounwind } |
0 commit comments