[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:33 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>


================
@@ -4537,6 +4540,9 @@ static llvm::Value *emitArraySubscriptGEP(CodeGenFunction &CGF,
                                           bool signedIndices,
                                           SourceLocation loc,
                                     const llvm::Twine &name = "arrayidx") {
+  if (CGF.getLangOpts().HLSL && inbounds && CGF.getLangOpts().EmitStructuredGEP)
+    return CGF.Builder.CreateStructuredGEP(elemType, ptr, indices);
----------------
s-perron wrote:

I'm wondering how the `inbounds` and `EmitStructruedGEP` should interact. Is the plan to eventually make it an assert. If you want structuredGEPs then all accesses must be inbounds? Or will we allow clang to generate a mix of instructions?

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


More information about the cfe-commits mailing list