================
@@ -4497,6 +4497,17 @@ Address CodeGenFunction::EmitArrayToPointerDecay(const 
Expr *E,
   if (!E->getType()->isVariableArrayType()) {
     assert(isa<llvm::ArrayType>(Addr.getElementType()) &&
            "Expected pointer to array");
+
+    if (getLangOpts().HLSL && getLangOpts().EmitStructuredGEP) {
+      llvm::Value *Ptr = Addr.emitRawPointer(*this);
+      if (auto *C = dyn_cast<llvm::Constant>(Ptr))
+        return Address(C, Addr.getElementType(), Addr.getAlignment(),
+                       Addr.isKnownNonNull());
+      return Address(
+          Builder.CreateStructuredGEP(NewTy, Addr.getBasePointer(), {}),
----------------
Keenuts wrote:

Simplified this: given we don't index, emitting the SGEP is useless, reverted 
to emit the address directly in such case. Thanks!

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