diff options
author | Wenju He <wenju.he@intel.com> | 2023-12-19 13:54:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 13:54:25 +0800 |
commit | 108989b7176651d7a0f3161a7baba588f7c4ea52 (patch) | |
tree | 2105ffc72e895b9f57d6c314bd4230c518018617 /llvm/lib/IR | |
parent | 9b21866feaea912bdb2d76060ef79da8a4905570 (diff) | |
download | llvm-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.cpp | 2 |
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); |