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

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 11:02:08 PDT 2022


beanz added inline comments.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:167-170
+    assert(cast<ConstantInt>(CS->getOperand(0))->getValue() == 65535 &&
+           "HLSL doesn't support setting priority for global ctors.");
+    assert(isa<ConstantPointerNull>(CS->getOperand(2)) &&
+           "HLSL doesn't support COMDat for global ctors.");
----------------
aaron.ballman wrote:
> Do we have sema checks for this so users get decent diagnostics instead of a crash (or miscompile)?
It looks like COMDats are only attached if object format supports them (and DXContainer isn't properly handled there). I don't think there is any sema-level validation because the COMDat just binds to the global value address. I'll get a patch up to llvm::Triple to mark DXContainer as not supporting COMDat.


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