Skip to content

[clang][Driver][DirectX] Add /Zs flag support - #169

Closed
dzhidzhoev wants to merge 6 commits into
dx-debugfrom
dx/clang/zs/base
Closed

dzhidzhoev wants to merge 6 commits into
dx-debugfrom
dx/clang/zs/base

Conversation

@dzhidzhoev

Copy link
Copy Markdown
Contributor

When DXC is called with /Zs flag, it emits "slim" debug info. It effectively means that ILDB section is omitted from the main DXContainer output and from the output PDB file.

This patch reimplements similar behavior in llc and Clang.

Since /Zs is already used in clang-cl driver, and it has different meaning there, /Zs definition in Options.td was generalized, and some changes were made to how the flag is processed in case of CL mode, to preserve the behavior of the flag.

When DXC is called with /Zs flag, it emits "slim" debug info.
It effectively means that ILDB section is omitted from the main DXContainer
output and from the output PDB file.

This patch reimplements similar behavior in llc and Clang.

Since /Zs is already used in clang-cl driver, and it has different
meaning there, /Zs definition in Options.td was generalized, and some changes
were made to how the flag is processed in case of CL mode, to preserve
the behavior of the flag.
@dzhidzhoev
dzhidzhoev requested review from asavonic and kuilpd June 16, 2026 03:57
Comment on lines +9331 to +9334
def _SLASH_Zs
: CLFlag<"Zs", [CLOption, DXCOption]>,
HelpText<"Run the preprocessor, parser and semantic analysis stages">,
HelpTextForVariants<[DXCOption], "Emit slim PDB debug info">;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this existing option? Maybe some builds somewhere use this alias. We can still create a new one with the same console name where other DXC options are, and it will be used only through clang-dxc.

DwarfFission = DwarfFissionKind::None;
}
} else if (Args.hasArg(options::OPT__SLASH_Zs) && D.IsDXCMode()) {
DebugInfoKind = llvm::codegenoptions::DebugInfoConstructor;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see DXC doing the something similar, why are we limiting the debug info? As I understood, the point of /Zs is just to omit ILDB from the PDB file.

Comment on lines +333 to +337
static bool isCLSyntaxOnly(const Driver &D, const llvm::opt::ArgList &Args) {
return Args.hasArg(options::OPT_fsyntax_only) ||
(D.IsCLMode() && Args.hasArg(options::OPT__SLASH_Zs));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we wouldn't have to do this if we create a separate DXC-only /Zs option.

; SLIM: - Name: HASH
; SLIM: - Name: ILDN

;; Check that /Zss can still hash from ILDB when /Zs omits it from output

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work fine if we enable codegenoptions::DebugInfoConstructor for /Zs? Wouldn't this produce a different hash compared to /Zi?

@dzhidzhoev dzhidzhoev closed this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants