[all-commits] [llvm/llvm-project] 42d801: [SPIR-V] Account for zext in a llvm intrinsic call...

Vyacheslav Levytskyy via All-commits all-commits at lists.llvm.org
Wed Apr 17 02:51:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42d801d4e42ff8c47c3a24d562774851e3a424f5
      https://github.com/llvm/llvm-project/commit/42d801d4e42ff8c47c3a24d562774851e3a424f5
  Author: Vyacheslav Levytskyy <vyacheslav.levytskyy at intel.com>
  Date:   2024-04-17 (Wed, 17 Apr 2024)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
    A llvm/test/CodeGen/SPIRV/transcoding/memcpy-zext.ll
    M llvm/test/CodeGen/SPIRV/transcoding/spirv-private-array-initialization.ll

  Log Message:
  -----------
  [SPIR-V] Account for zext in a llvm intrinsic call (#88903)

This PR addresses an issue that may arise when an integer argument size
differs from a machine word size for the target in a call to llvm
intrinsic. The following example demonstrates the issue:

```
@__const.test.arr = private unnamed_addr addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3]

define spir_func void @test() {
entry:
  %arr = alloca [3 x i32], align 4
  %dest = bitcast ptr %arr to ptr
  call void @llvm.memcpy.p0.p2.i32(ptr align 4 %dest, ptr addrspace(2) align 4 @__const.test.arr, i32 1024, i1 false)
  ret void
}

declare void @llvm.memcpy.p0.p2.i32(ptr nocapture writeonly, ptr addrspace(2) nocapture readonly, i32, i1)
```

Depending on the target this code may work or may fail without this PR
due to the fact that IR Translation step introduces additional `zext`
when type of the 3rd argument of `@llvm.memcpy.p0.p2.i32` differs from
machine word.

This PR addresses the issue by adding type deduction for a newly
inserted G_ZEXT generic opcode.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list