|
| 1 | +;=========================== begin_copyright_notice ============================ |
| 2 | +; |
| 3 | +; Copyright (C) 2025 Intel Corporation |
| 4 | +; |
| 5 | +; SPDX-License-Identifier: MIT |
| 6 | +; |
| 7 | +;============================ end_copyright_notice ============================= |
| 8 | +; REQUIRES: llvm-16-plus, regkeys |
| 9 | +; RUN: igc_opt --regkey "EnableOpaquePointersBackend=1" --igc-promote-bools -S < %s 2>&1 | FileCheck %s |
| 10 | + |
| 11 | +; This test verifies that the pass can handle nested users of opaque pointer function calls |
| 12 | +; without generating undef values and deleting said users unnecessarily. |
| 13 | +; ------------------------------------------------ |
| 14 | +; NoUndefUsersOpaque |
| 15 | +; ------------------------------------------------ |
| 16 | + |
| 17 | +; CHECK-LABEL: define spir_kernel void @test_kernel() |
| 18 | +; CHECK: call spir_func ptr addrspace(4) @joint_helper(i8 1) |
| 19 | +; CHECK-NOT: undef |
| 20 | +; CHECK: ptrtoint ptr addrspace(4) |
| 21 | +; CHECK: ret void |
| 22 | + |
| 23 | +; CHECK-LABEL: define internal spir_func ptr addrspace(4) @joint_helper(i8 %flag) |
| 24 | +; CHECK-NOT: i1 |
| 25 | +; CHECK: alloca i8, align 1, addrspace(4) |
| 26 | +; CHECK: getelementptr inbounds i8, ptr addrspace(4) |
| 27 | +; CHECK: ret ptr addrspace(4) |
| 28 | + |
| 29 | +define spir_kernel void @test_kernel() #0 { |
| 30 | +entry: |
| 31 | + %call = call spir_func ptr addrspace(4) @joint_helper(i1 1) #0 |
| 32 | + %bc = bitcast ptr addrspace(4) %call to ptr addrspace(4) |
| 33 | + %asint = ptrtoint ptr addrspace(4) %bc to i64 |
| 34 | + ret void |
| 35 | +} |
| 36 | + |
| 37 | +define internal spir_func ptr addrspace(4) @joint_helper(i1 %flag) #0 { |
| 38 | +entry: |
| 39 | + %base = alloca i1, align 1, addrspace(4) |
| 40 | + %gep = getelementptr inbounds i1, ptr addrspace(4) %base, i64 1 |
| 41 | + ret ptr addrspace(4) %gep |
| 42 | +} |
| 43 | + |
| 44 | +attributes #0 = { nounwind } |
0 commit comments