================
@@ -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);
----------------
Keenuts wrote:

For now, the SGEP instruction documentation says it assumes inbounds. So to 
start, I reduced the scope to calls with the inbounds bit.
They as we add more tests to the frontend (or migrate existing ones), we should 
encounter new variations around this and then we'll have to figure out what to 
do:
 - maybe sometimes emit without `inbounds` be could have, so we should fix it
 - maybe we don't mark it as `inbounds`, but in the context of SGEP, it would 
be fine (as the index is runtime, cannot be checked, but we can assume inbounds)

https://github.com/llvm/llvm-project/pull/177332
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to