Skip to content

Commit 133b7f1

Browse files
author
git apple-llvm automerger
committed
Merge commit '9e02e8f1a766' from llvm.org/main into next
2 parents 782ec4c + 9e02e8f commit 133b7f1

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,13 +716,14 @@ SPIRVType *SPIRVGlobalRegistry::createSPIRVType(
716716
ForwardPointerTypes[PType] = getOpTypeForwardPointer(SC, MIRBuilder);
717717
return ForwardPointerTypes[PType];
718718
}
719-
Register Reg(0);
720719
// If we have forward pointer associated with this type, use its register
721720
// operand to create OpTypePointer.
722-
if (ForwardPointerTypes.contains(PType))
723-
Reg = getSPIRVTypeID(ForwardPointerTypes[PType]);
721+
if (ForwardPointerTypes.contains(PType)) {
722+
Register Reg = getSPIRVTypeID(ForwardPointerTypes[PType]);
723+
return getOpTypePointer(SC, SpvElementType, MIRBuilder, Reg);
724+
}
724725

725-
return getOpTypePointer(SC, SpvElementType, MIRBuilder, Reg);
726+
return getOrCreateSPIRVPointerType(SpvElementType, MIRBuilder, SC);
726727
}
727728
llvm_unreachable("Unable to convert LLVM type to SPIRVType");
728729
}

llvm/test/CodeGen/SPIRV/opencl/device_execution/execute_block.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
22

3-
; TODO(#60133): Requires updates following opaque pointer migration.
4-
; XFAIL: *
53
; REQUIRES: asserts
64

75
; CHECK: %[[#bool:]] = OpTypeBool
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2+
; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: %[[TyInt8:.*]] = OpTypeInt 8 0
5+
; CHECK: %[[TyInt8Ptr:.*]] = OpTypePointer {{[a-zA-Z]+}} %[[TyInt8]]
6+
; CHECK: %[[TyStruct:.*]] = OpTypeStruct %[[TyInt8Ptr]] %[[TyInt8Ptr]]
7+
; CHECK: %[[ConstStruct:.*]] = OpConstantComposite %[[TyStruct]] %[[ConstField:.*]] %[[ConstField]]
8+
; CHECK: %[[TyStructPtr:.*]] = OpTypePointer {{[a-zA-Z]+}} %[[TyStruct]]
9+
; CHECK: OpVariable %[[TyStructPtr]] {{[a-zA-Z]+}} %[[ConstStruct]]
10+
11+
@a = addrspace(1) constant i32 123
12+
@struct = addrspace(1) global {ptr addrspace(1), ptr addrspace(1)} { ptr addrspace(1) @a, ptr addrspace(1) @a }
13+
14+
define spir_kernel void @foo() {
15+
ret void
16+
}

0 commit comments

Comments
 (0)