[PATCH] D132977: [HLSL] Call global constructors inside entry
Xiang Li via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 30 15:21:20 PDT 2022
python3kgae 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)
----------------
beanz wrote:
> 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.
I saw dxc did call ctor for all entries. Maybe to match the behavior, we need to do the same thing.
But I don't understand why we must do that except to match what dxc does.
Maybe we can also have a test for lib profile to make understanding things easier?
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