[PATCH] D132977: [HLSL] Call global constructors inside entry

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 30 14:58:54 PDT 2022


beanz added inline comments.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:151
+  llvm::Module &M = CGM.getModule();
+  const auto *GlobalCtors = M.getNamedGlobal("llvm.global_ctors");
+  if (!GlobalCtors)
----------------
python3kgae wrote:
> Don't need to generate CtorCalls for lib profile in clang codeGen.
> Have to do this when linking anyway.
Are you sure? The global constructors contain the `createHandle` calls for resources, and DXC does currently generate those inside shader entries for lib shaders.

I'm sure we're not generating those _correctly_ with this change, but I think we still need the constructor calls inside any function annotated with the `[shader(...)]` attribute.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132977/new/

https://reviews.llvm.org/D132977



More information about the cfe-commits mailing list