[llvm-branch-commits] [clang] [HLSL] Global resource arrays element access (PR #152454)

Finn Plummer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 8 09:16:05 PDT 2025


================
@@ -4532,6 +4533,15 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
                                  LHS.getBaseInfo(), TBAAAccessInfo());
   }
 
+  // The HLSL runtime handle the subscript expression on global resource arrays.
+  if (getLangOpts().HLSL && (E->getType()->isHLSLResourceRecord() ||
+                             E->getType()->isHLSLResourceRecordArray())) {
+    std::optional<LValue> LV =
+        CGM.getHLSLRuntime().emitResourceArraySubscriptExpr(E, *this);
+    if (LV.has_value())
+      return *LV;
+  }
----------------
inbelic wrote:

It seems strange to me to only conditionally return here. Curious if that ever happens?

https://github.com/llvm/llvm-project/pull/152454


More information about the llvm-branch-commits mailing list