[llvm] [SPIRV] Handle vector load/store for RWBuffer (PR #125581)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 06:47:52 PST 2025
================
@@ -748,7 +748,16 @@ Type *SPIRVEmitIntrinsics::deduceElementTypeHelper(
if (II && II->getIntrinsicID() == Intrinsic::spv_resource_getpointer) {
auto *ImageType = cast<TargetExtType>(II->getOperand(0)->getType());
assert(ImageType->getTargetExtName() == "spirv.Image");
- Ty = ImageType->getTypeParameter(0);
+ for (auto U : II->users()) {
+ if (auto *LD = dyn_cast<LoadInst>(U)) {
+ Ty = LD->getType();
+ } else if (auto *ST = dyn_cast<StoreInst>(U)) {
+ Ty = ST->getAccessType();
+ } else {
+ llvm_unreachable("Unexpected user. The only expect users of a "
+ "resource pointer to an image are loads and stores");
+ }
+ }
----------------
Keenuts wrote:
Seems like silently overriding the type without saying anything is just hoping a bug will be caught later
https://github.com/llvm/llvm-project/pull/125581
More information about the llvm-commits
mailing list