[clang] [CIR] SubscriptExpr for VariableLengthArray (PR #175370)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 09:20:43 PST 2026


================
@@ -1165,7 +1159,14 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
                                  lv.getBaseInfo());
   }
 
-  const mlir::Value idx = emitIdxAfterBase(/*promote=*/true);
+  // The HLSL runtime handles subscript expressions on global resource arrays
+  // and objects with HLSL buffer layouts.
+  if (getLangOpts().HLSL) {
+    cgm.errorNYI(e->getSourceRange(), "emitArraySubscriptExpr: HLSL");
+    return {};
+  }
+
+  mlir::Value idx = emitIdxAfterBase(/*promote=*/true);
----------------
AmrDeveloper wrote:

Because we use this idx variable for the other cases too, all of them are the same with promote option enabled, I am okey also with moving it to end up with one copy in each expr kind but i think they will not change

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


More information about the cfe-commits mailing list