This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] add -fcgl option flag.
ClosedPublic

Authored by python3kgae on May 4 2022, 11:17 PM.

Details

Summary

fcgl option will make compilation stop after clang codeGen and output the llvm ir.
It is added to check clang codeGen output for HLSL.

It will be translated into -S -emit-llvm and -disable-llvm-passes.

Diff Detail

Event Timeline

python3kgae created this revision.May 4 2022, 11:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 11:17 PM
python3kgae requested review of this revision.May 4 2022, 11:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 11:17 PM
aaron.ballman added inline comments.
clang/include/clang/Driver/Options.td
6765

Any particular reason for this name? Naively, I have no idea what this does or how it relates to code generation.

6766
clang/unittests/Driver/ToolChainTest.cpp
613 ↗(On Diff #427204)

Any reason not to use the typical lit tests for this? It seems like you should be able to add a Driver test that does -### and looks for the expected pass-down flags. And then you can add a -cc1 test to ensure that the -fcgl flag isn't supported there.

beanz added inline comments.May 5 2022, 7:55 AM
clang/include/clang/Driver/Options.td
6765

I have no idea what this name is short for… code gen language?… likeness?… lobotomy?…

We have this flag in DXC, and it is a useful shorthand.

Don’t know if @python3kgae or @pow2clk know what the actual abbreviation is.

6766

This really has nothing to do with DXIL as a target, and will apply to any HLSL target out of clang. A more accurate description might be that it disables all optimization and code generation passes.

aaron.ballman added inline comments.May 5 2022, 8:44 AM
clang/include/clang/Driver/Options.td
6765

Can we pick a more descriptive name, or would that make portability too much of a challenge? Could we have a more descriptive name and then have -fcgl be an alias for it, or is that overkill because this is a rarely-used option?

python3kgae marked 2 inline comments as done.May 5 2022, 8:56 AM
python3kgae added inline comments.
clang/include/clang/Driver/Options.td
6765

Sure. I'll add a more descriptive name and alias fcgl to it.

It is something like frontend codeGen listing if I remember correctly.

clang/unittests/Driver/ToolChainTest.cpp
613 ↗(On Diff #427204)

I'll use -### to add a lit test.

python3kgae marked 2 inline comments as done.

Add emit_pristine_llvm to make fcgl easier to understand.
Also change unit test to lib test.

python3kgae retitled this revision from [HLSL} add -fcgl option flag. to [HLSL] add -fcgl option flag..May 6 2022, 12:26 AM
aaron.ballman accepted this revision.May 6 2022, 5:37 AM

LGTM aside from a tiny nit.

clang/include/clang/Driver/Options.td
6768–6769

Aliases typically skip their help text.

This revision is now accepted and ready to land.May 6 2022, 5:37 AM

Remove HelpText for alias option.

This revision was landed with ongoing or failed builds.May 6 2022, 11:42 AM
This revision was automatically updated to reflect the committed changes.