Repository navigation
[clang][Driver][DirectX] Add /Zs flag support - #169
Closed
dzhidzhoev wants to merge 6 commits into
Closed
dzhidzhoev wants to merge 6 commits into
dzhidzhoev wants to merge 6 commits into
Conversation
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.
kuilpd
reviewed
Jun 16, 2026
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">; |
Contributor
There was a problem hiding this comment.
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; |
Contributor
There was a problem hiding this comment.
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)); | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
Does this work fine if we enable codegenoptions::DebugInfoConstructor for /Zs? Wouldn't this produce a different hash compared to /Zi?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.