aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorWenju He <wenju.he@intel.com>2023-12-19 13:54:25 +0800
committerGitHub <noreply@github.com>2023-12-19 13:54:25 +0800
commit108989b7176651d7a0f3161a7baba588f7c4ea52 (patch)
tree2105ffc72e895b9f57d6c314bd4230c518018617 /llvm/lib/IR
parent9b21866feaea912bdb2d76060ef79da8a4905570 (diff)
downloadllvm-108989b7176651d7a0f3161a7baba588f7c4ea52.zip
llvm-108989b7176651d7a0f3161a7baba588f7c4ea52.tar.gz
llvm-108989b7176651d7a0f3161a7baba588f7c4ea52.tar.bz2
[IR] Disallow ZeroInit for spirv.Image (#73887)
According to spirv spec, OpConstantNull's result type can't be image type. So we can't generate zeroinitializer for spirv.Image.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Type.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 85d779c..c59bc36 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -834,6 +834,8 @@ struct TargetTypeInfo {
static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
LLVMContext &C = Ty->getContext();
StringRef Name = Ty->getName();
+ if (Name.equals("spirv.Image"))
+ return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::CanBeGlobal);
if (Name.starts_with("spirv."))
return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::HasZeroInit,
TargetExtType::CanBeGlobal);