[llvm] [DirectX] Disallow ElementIndex for raw buffer accesses (PR #173320)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 23 12:32:00 PST 2025
================
@@ -272,6 +272,22 @@ class OpLowerer {
return false;
}
+ Error validateRawBufferElementIndex(Value *Resource, Value *ElementIndex) {
+ bool IsStructured =
+ cast<RawBufferExtType>(Resource->getType())->isStructured();
+ bool IsPoison = isa<PoisonValue>(ElementIndex);
+
+ if (IsStructured && IsPoison)
+ return make_error<StringError>(
+ "Element index of structured buffer may not be poison",
+ inconvertibleErrorCode());
+ else if (!IsStructured && !IsPoison)
----------------
bogner wrote:
Personally I like the else here since the condition parallels the previous one, but I don't feel strongly so I've updated it to make clang-tidy (and I suppose it seems you as well) happy here.
https://github.com/llvm/llvm-project/pull/173320
More information about the llvm-commits
mailing list