Skip to content

Commit 9d25526

Browse files
vsemenov368sys-cmllvm
authored andcommitted
Do not convert pointer arguments to int
.
1 parent 3c1f20a commit 9d25526

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2020-2024 Intel Corporation
3+
Copyright (C) 2020-2025 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -145,7 +145,7 @@ static SPIRVType evaluateImageTypeFromSPVIR(SPIRVIRTypes::Dim Dim,
145145
break;
146146
case SPIRVIRTypes::DimBuffer:
147147
ResultType = SPIRVType::Image1dBuffer;
148-
break;
148+
break;
149149
}
150150
} else {
151151
switch (Dim) {
@@ -370,8 +370,7 @@ static Value *getOriginalValue(Argument &Arg) {
370370
if (Arg.hasOneUse()) {
371371
User *U = Arg.user_back();
372372
if (isArgConvIntrinsic(U) || isa<BitCastInst>(U) ||
373-
isa<AddrSpaceCastInst>(U) || isa<IntToPtrInst>(U) ||
374-
isa<PtrToIntInst>(U))
373+
isa<AddrSpaceCastInst>(U) || isa<IntToPtrInst>(U))
375374
return U;
376375
}
377376

@@ -549,7 +548,7 @@ static void rewriteKernelArguments(Function &F) {
549548
// 2. Kernel is referenced in @llvm.global.annotations
550549
// We have to replace the original function with the new one
551550
if (!F.use_empty()) {
552-
Value *Ptr = &F;
551+
Value *Ptr = &F;
553552
assert(Ptr->hasOneUse());
554553
if (isa<BitCastOperator>(Ptr->user_back())) {
555554
Ptr = Ptr->user_back();

GenXIntrinsics/test/Adaptors/opaque_ptrs/annotated_args_reader.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
; CHECK-SAME: [[IM3D:%[^,]+]],
3232
; CHECK-SAME: i32
3333
; CHECK-SAME: [[SAMP:%[^,]+]],
34-
; CHECK-SAME: i64
34+
; CHECK-SAME: ptr addrspace(1)
3535
; CHECK-SAME: [[PTR:%[^,]+]],
3636
; CHECK-SAME: <4 x i32>
3737
; CHECK-SAME: [[GEN:%[^)]+]])
@@ -42,7 +42,7 @@ define spir_kernel void @test(target("spirv.BufferSurfaceINTEL", 2) %buf, target
4242
; CHECK-NOT: [[IM2D]]
4343
; CHECK-NOT: [[IM3D]]
4444
; CHECK-NOT: [[SAMP]]
45-
; CHECK-NOT: [[PTR]]
45+
; CHECK: [[PTR]]
4646
; CHECK-NOT: [[GEN]]
4747
%buf.conv = call i32 @llvm.genx.address.convert.i32.t_spirv.BufferSurfaceINTEL_2(target("spirv.BufferSurfaceINTEL", 2) %buf)
4848
%im1d.conv = call i32 @llvm.genx.address.convert.i32.t_spirv.Image_isVoid_0_0_0_0_0_0_2(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 2) %im1d)

0 commit comments

Comments
 (0)