[clang] [Clang][HLSL] Start emitting structured GEP instruction (PR #177332)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 26 07:05:32 PST 2026
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/177332 at github.com>
================
@@ -1395,9 +1396,18 @@ std::optional<LValue> CGHLSLRuntime::emitBufferArraySubscriptExpr(
Indices.push_back(Idx);
Indices.push_back(llvm::ConstantInt::get(CGF.Int32Ty, 0));
- llvm::Value *GEP = CGF.Builder.CreateGEP(LayoutTy, Addr.emitRawPointer(CGF),
- Indices, "cbufferidx");
- Addr = Address(GEP, Addr.getElementType(), RowAlignedSize, KnownNonNull);
+ if (CGF.getLangOpts().EmitStructuredGEP) {
+ if (auto *AT = dyn_cast<llvm::ArrayType>(Addr.getElementType()))
+ LayoutTy = llvm::ArrayType::get(LayoutTy, AT->getNumElements());
----------------
s-perron wrote:
In what situation is this not an array type? How do we know it will make sense to index into the layout type when it is not an array type?
https://github.com/llvm/llvm-project/pull/177332
More information about the cfe-commits
mailing list