beanz added inline comments.
================ Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:220 + + // Const subscript operators return copies of elements, non-const return a + // reference so that they are assignable. ---------------- python3kgae wrote: > If we reuse this function for StructuredBuffer, then const subscript return a > const reference could be better? Why? Since this should get inlined return value optimization should eliminate the redundant copies. ================ Comment at: clang/test/CodeGenHLSL/buffer-array-operator.hlsl:4 +const RWBuffer<float> In; +RWBuffer<float> Out; + ---------------- python3kgae wrote: > Maybe change In to RWBuffer<float4> > And Out[Idx] = In[Idx].z; > So we also test vector case? None of the added code here depends on the template parameter type. Putting a vector in increases the complexity of the output, but I'm unsure it extends the test coverage meaningfully. ================ Comment at: clang/test/CodeGenHLSL/buffer-array-operator.hlsl:16 +// CHECK: float @"??A?$RWBuffer@M@hlsl@@QBAMI@Z" +// CHECK: %this1 = load ptr, ptr %this.addr, align 4 +// CHECK-NEXT: %h = getelementptr inbounds %"class.hlsl::RWBuffer", ptr %this1, i32 0, i32 0 ---------------- python3kgae wrote: > Where is the this.addr coming from? That is how clang generates stored locations for input parameters. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131268/new/ https://reviews.llvm.org/D131268 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits