================
@@ -5521,6 +5545,14 @@ static Address emitAddrOfFieldStorage(CodeGenFunction 
&CGF, Address base,
 
   unsigned idx =
     CGF.CGM.getTypes().getCGRecordLayout(rec).getLLVMFieldNo(field);
+  llvm::Type *StructType =
+      CGF.CGM.getTypes().getCGRecordLayout(rec).getLLVMType();
+
+  if (CGF.getLangOpts().HLSL && CGF.getLangOpts().EmitStructuredGEP)
+    return RawAddress(
+        CGF.Builder.CreateStructuredGEP(StructType, base.emitRawPointer(CGF),
----------------
Keenuts wrote:

I'm afraid doing this would cause issues on more complex codes: the SGEP gives 
us some guarantees around what optimizations can do. Emitting a GEP instead 
will allow optimizations to merge those and do normal pointer arithmetic. Seems 
to me that the simplest approach is to always emit. But maybe we'll see in the 
future that in some cases we can emit a GEP.

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