Commit graph

1521 commits

Author SHA1 Message Date
Matt Arsenault
3c3a18e239
clang: Store vendor GPU kinds in OffloadArch instead of re-listing GPUs (#213362)
OffloadArch was a flat enum that hand-duplicated every AMDGPU and NVPTX
target, plus a few edge cases. This was yet another place that needed
updating every time a new target is added, which should now be avoided.
Replace with a tagged union-like scheme.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
2026-08-01 06:14:04 +00:00
Yaxun (Sam) Liu
298355525c
[HIP] Support device-only linking of bitcode offload binaries (#212342)
The new offload driver packages multi-architecture bitcode in LLVM
offload binaries. A later `--hip-link --offload-device-only`
invocation treated these `.bc` inputs as host LLVM IR and dropped
them before linking.

Pass these inputs directly to clang-linker-wrapper when producing a
device fat binary. The wrapper can then extract and link each
requested GPU architecture.
2026-07-28 10:19:31 -04:00
Yaxun (Sam) Liu
cdfa687cd2
[Driver] Print C++ standard library info (#207798)
Users and tools sometimes need to know which C++ standard library Clang
selected, and which include directories the driver added for it. Today
they have to inspect verbose or `-###` output.

Add options to print this information directly:

`--print-cxx-stdlib`
`--print-cxx-stdlib-include-dirs`

For MSVC targets, the default printed library is `msvcstl`. Explicit
`-stdlib=` values are still reported as requested. The include-dir query
reuses toolchain logic, including the MSVC STL include path for the
default MSVC case.
2026-07-23 17:59:38 -04:00
Matt Arsenault
f049aa1e9b
clang: Remove dead getConflictOffloadArchCombination virtual (#209271) 2026-07-13 19:46:21 +00:00
Matt Arsenault
20429870a5
clang: Remove extra space and braces in flang check (#208714) 2026-07-10 13:23:02 +00:00
Yaxun (Sam) Liu
f77162dd86
[Clang][Driver] Parallelize device cc1 jobs for offload arches
[Clang][Driver] Parallelize device cc1 jobs for offload arches

Large offload builds can target many device architectures. A common
ROCm build can target around ten `--offload-arch=` values. For a large
single translation unit, the offload device cc1 work before
clang-linker-wrapper can become a build-time bottleneck. Those
per-architecture jobs are independent, but the driver ran them serially,
so `--offload-jobs=` only helped the later wrapper work.

Borrow the parallel job mechanism used by clang-linker-wrapper for the
pre-wrapper device cc1 jobs. Device job construction marks eligible
compile and backend jobs with an offload parallel group. The generic
executor only consumes that opt-in metadata for adjacent device jobs
with distinct bound architectures.

The parallel path is disabled for driver-side output modes and callbacks
so existing serial output handling is preserved. This is NFC for
non-offload compilation.
2026-07-10 09:21:57 -04:00
Matt Arsenault
640079288c
clang/AMDGPU: Merge toolchain subclasses (#204863)
Simplify the toolchain implementations by collapsing
them into one. Previously we had a confusing split. The
AMDGPUToolChain base class implemented much of the base
support. It was subclassed by ROCMToolChain, which would
have been more accurately described as the offloading subclass.

That was further subclassed into HIP and OpenMP specific subclasses.
Deleting those two is the important part of this change. There was
code duplication, and features arbitrarily handled in one but not
the other. The offload kind is passed in almost everywhere if you
really need to know the original language. However, I consider
this an antifeature, and it is really poor QoI to have the HIP
and OpenMP toolchains behave differently in any way. The platform
should be consistent and the driver behaviors should not depend
on the language.

There is additional mess in the handling of spirv, which this
only partially addresses. There are two different spirv toolchain
paths, which for some reason is keyed off of the amdhsa OS, which
is not the property that should change this. I think it will
ultimately be simplier to just merge all spirv handling into HIPSPV.

The copy-paste machine did most of the work here, and I manually
applied some logical fixups that became apparent after the merge.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-10 12:29:59 +00:00
Matt Arsenault
24a5231188
AMDGPU: Introduce amdgpu triple arch (#206480)
Move towards using the triple for representing incompatible
ISA changes. Use the subarch field to represent the various
incompatible cases. Previously we pretended a single triple arch
was universally compatible, and only distinguished by function
level subtargets. Move towards using distinct triples to enable
more sophisticated toolchain handling in the future, like proper
runtime library linking.

Introduce a new subarch per unique ISA, but also introduce
"major subarches" which are compatible by a set of covered
minor ISA versions. These map to the existing generic targets.
There are a few placeholder subarch entries, which currently
have missing backing generic arches for codegen.

This should be the preferred triple arch name going forward,
but is treated as an alias of amdgcn. This does not yet change
clang to emit the new triples.

Part of #154925
2026-07-09 13:43:41 +02:00
Jacek Caban
73867dce09
[clang][ARM64X] Support compiling both native and EC objects with -marm64x (#207612)
When -marm64x is used during the assembly phase, construct jobs for both
native and EC targets and merge their outputs using llvm-objcopy.

Allow passing ArchName to computeTargetTriple on non-Darwin targets to
enable BindArchAction on other platforms. Additionally, allow passing
multiple inputs to ObjcopyJobAction and use this capability to construct
ARM64X merge jobs.
2026-07-08 00:41:21 +02:00
Sirraide
1381ef49fc
[Clang] Add flags and lang option for C++2d (#203992)
This adds diagnostic groups, command-line options, a language option,
and various other things required to support `-std=c++2d`. I haven’t
touched e.g. clang-tidy or clang-format, as I’m not really familiar w/
either. This is only meant to add the most necessary parts to support
C++29 mode.

I grepped for `CPlusPlus26`/`C++26`/`C++2c` and updated all places I
could find where we need to handle every language mode in some way or
another.

This patch is roughly based on b763d6a4ed.
2026-07-03 21:37:02 +00:00
Kelvin Li
518bd65d62
[driver][AIX] Accept '32_64' and 'any' as valid value for OBJECT_MODE (#205180)
If OBJECT_MODE is set to '32_64' or 'any', the driver accepts the
setting silently.
2026-06-26 17:54:18 -04:00
Wenju He
b37b10d521
[Driver][SYCL] Treat stdin as C++ when -fsycl is active (#204968)
1723b7a301 added a frontend check that rejects C inputs when SYCL mode
is active (since SYCL requires C++). The stdin path in BuildInputs
hardcoded TY_C regardless of driver mode, so `-fsycl -dM -E -` would
pass -x c to cc1 and trigger the new diagnostic.

Fix: use TY_CXX for stdin when IsSYCL.

Also, upstream a downstream test that fails due to 1723b7a301.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 07:58:54 +08:00
Jan Korous
c4249350f2
[clang][ssaf] Shorten directory name to ScalableStaticAnalysis (#204697)
The directory name ScalableStaticAnalysisFramework produces build paths
that exceed Windows' MAX_PATH limit (260 chars) on downstream CI bots.

The clang-ssaf-format / clang-ssaf-linker tool names and SSAF-prefixed
source filenames are unchanged.

Assisted-By: Claude Opus 4.7

---------

Co-authored-by: Aviral Goel <goel.aviral@gmail.com>
Co-authored-by: Aviral Goel <aviralg@users.noreply.github.com>
2026-06-24 16:44:57 -07:00
Matt Arsenault
448b725bb7
clang/Driver: Use struct type for BoundArch instead of StringRef (#204748)
Change BoundArch arguments in the clang driver from StringRef (or
sometimes const char*) to a dedicated struct type that contains both
the architecture string and a parsed OffloadArch enum field. In the
future it may be useful to contain other feature bits here.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-22 15:19:18 +00:00
Joseph Huber
6b59e09d14
[HIP] Fix --no-offload-new-driver behavior after #201457 (#205094)
Summary:
https://github.com/llvm/llvm-project/pull/201457 changed the default for
all targets. Even though the old offload driver is getting removed soon
we shouldn't break it for the LLVM23 release. This simply reverts to the
original behavior, the old driver builds its jobs manually so we can
just turn off this one specific case unless the user forced it.
2026-06-22 09:18:50 -05:00
Matt Arsenault
b3022110d8
clang/AMDGPU: Use effective triple instead of raw toolchain triple (#205054)
Start using the effective triple instead of the raw toolchain triple.
For the moment this is NFC, but will change when new uses of the subarch
field are introduced.
2026-06-22 14:13:37 +02:00
Tim Gymnich
467a5fe378
[clang] Avoid premature Twine .str() materialization (#204830)
Several call sites pass `expr.str()` to parameters of type `const
llvm::Twine &`, forcing a throwaway heap std::string that is immediately
rewrapped into a Twine. Drop the `.str()` and let Twine accept the
StringRef/concatenation directly.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 17:22:47 +02:00
Maryam Moghadas
53e36fb783
[z/OS][Clang] Raise minimum supported z/OS target level to 3.1 (#203580)
Update z/OS target validation and tests to reject targets older than
z/OS 3.1
2026-06-15 11:42:55 -04:00
Matt Arsenault
951c67d4db
clang/AMDGPU: Use TranslateArgs from the base toolchain instead of the host (#198627)
This fixes -Xopenmp-target / -Xarch for arbitrary arguments. HIP and
OpenMP had cargo-cult broken implementations of TranslateArgs, which called the
host toolchain's implementation, and then special case transferred either
-march or -mcpu to the device argument list. The respective device forwarding
flags should work for any argument, not just this one. The main feature that
needs to be preserved is the shared filtering of unsupported sanitizers to
degrade them into warnings.

Most of the changes here are dealing with fallout observed when
the host target is darwin. The darwin toolchain happens to have
some hacky statefulness tracking the compile target version, which
gets written and rewritten on argument parsing. To maintain this hack,
there are a few unused calls to getArgsForToolChain; start passing
OFK_Host to these so the offload toolchains don't get confused and think 
they're in a non-offload context.
2026-06-12 11:22:36 +02:00
Matt Arsenault
b25bc371ac
clang: Construct toolchains with normalized triples (#201869)
Avoid littering calls to normalize around by ensuring toolchains
always use a normalized triple. The test changes are due to
inconsistencies in the behavior of the triple APIs. If the arch name
is empty, normalize leaves it unchanged. If the triple is archname--,
normalize will expand the empty groups to be unknown. setArchName
will introduce the empty groups, which occurs in some of the triple
modifying driver path (mostly the handling of the endianness -m flags).

Driver is still holding onto a raw, unnormalized string triple but
leave that for a later cleanup.

Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
2026-06-10 19:31:13 +02:00
Joseph Huber
89b969eadb
Reapply "[Clang] Set default LTO mode for AMDGCN/SPIR-V targets to full" (#202714) (#202736)
This reverts commit 655462209f.
2026-06-09 14:15:42 -05:00
Krzysztof Parzyszek
655462209f
Revert "[Clang] Set default LTO mode for AMDGCN/SPIR-V targets to full" (#202714)
Reverts llvm/llvm-project#201457

Caused flang lit test failures, e.g.
https://lab.llvm.org/buildbot/#/builders/80/builds/22848
2026-06-09 12:58:01 -05:00
Joseph Huber
859ee9d83e
[Clang] Set default LTO mode for AMDGCN/SPIR-V targets to full (#201457)
Summary:
Previously we had several layers of if conditions that functionally
amounted to pretending like we were in LTO-mode. The previous changes
moved the LTO settings into the toolchain so we can now override it for
our offloading toolchains. This allows us to respect the LTO mode, where
previously there was no way to override it.

The main artifact of this PR should be trimming up the massive if
statement.

Some slight by-products on the old-driver path, but this can be
recovered with `-fno-offload-lto` and the old driver should be deleted
in a few months anyways.
2026-06-09 09:40:56 -05:00
Matt Arsenault
96f3f0a7f7
clang: Remove use of auto which may have been a triple copy (#201880) 2026-06-05 16:45:55 +00:00
Arthur Eubanks
9908117660
[clang] Add -fcrash-diagnostics-tar for tarball of crash reproducer files (#201643)
Makes it easier to move around crash diagnostics.

Reland of #198838 with crash-diagnostics-tar.c and
crash-report-crashfile.m fixed.
2026-06-04 17:54:45 +00:00
Arthur Eubanks
69f7aeb52e
Revert "[clang] Add -fcrash-diagnostics-tar for tarball of crash reproducer files" (#201622)
Reverts llvm/llvm-project#198838

Test failing at
https://lab.llvm.org/buildbot/#/builders/190/builds/43494
2026-06-04 16:47:03 +00:00
Arthur Eubanks
e44d060dfd
[clang] Add -fcrash-diagnostics-tar for tarball of crash reproducer files (#198838)
Makes it easier to move around crash diagnostics.
2026-06-04 09:01:01 -07:00
Kelvin Li
2e9f45a702
[clang][driver] Rename ClangExecutable and getClangProgramPath (NFC) (#200814)
This patch is to rename ClangExecutable to DriverExecutable and 
getClangProgramPath to getDriverProgramPath. This makes the 
name more neutral and less confusing when used in flang.
2026-06-04 10:38:30 -04:00
Joseph Huber
70d62e1e10
[Clang] Rework LTO mode selection to be a Toolchain property (#201155)
Summary:
Currently, the LTO mode is a property of the Driver, which makes sense
because it is used to set up phases. However, we currently have `-flto`
and `-foffload-lto`, which is a split that doesn't fully work with the
full context of a heterogenous compilation as it is 'all-or-nothing'.

This PR seeks to be mostly NFC for now, just moving the queries to a
per-toolchain interface rather than the static driver mode setting we
have right now. The *single* use of this before ToolChains are created
is for the Webassembly toolchain to set an include path. This is now
just a direct check on the flag, which is consistent. In the future they
could shift to fat LTO objects as well.

The main goal for the PR is to allow the GPU / Offloading toolchains to
specify their "real" LTO behavior. Right now SPIR-V and AMDGCN both
default to LTO, but rather than re-use the LTO handling we hack through
the driver phases to override it. Allowing this split would let us
heavily simplify this logic.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 08:26:16 -05:00
Naveen Seth Hanig
a16511c2d9
[clang][modules-driver] Precompile std modules independently of -o and final phase (#199289)
With this, Standard library modules are always precompiled as the
primary output of their `-cc1` invocation, instead of being produced as
a byproduct of compiling the Standard library modules to object files.

This also keeps Standard library module precompilation independent of
the final phase specified on the command line, so importing them keep
working under `-fsyntax-only` (and other command-line options that
specify the final phase).

This also makes the Standard library module precompilation independent
of the `-o` flag, so that a command like `clang -std=c++23
-fmodules-driver main.cpp -o main` no longer redirects the Standard
library module outputs to 'main', breaking the compilation.
2026-05-28 14:19:44 +00:00
Michael Kruse
60e95e5d26
[Flang][Driver] Add per-target search path for modules (#196558)
Adds the version- and target-specific path

    ../lib/clang/<version>/finclude/flang/<target>

to the intrinsic module search path in addition to

    ../finclude/flang

with the former taking precedence if a module file should exist in both.
The version/target-specific path is added by the driver by passing
`-fintrinsic-modules-path` to the `-fc1` invocation. This is consistent
with gfortran and the usual pattern that the driver resolves paths into
the resource path, not the frontend.

This PR adds nothing into that directory, which will be done in #171515.

Extracted out of #171515 as requested by
https://github.com/llvm/llvm-project/pull/171515#pullrequestreview-4179212219

---------

Co-authored-by: Tarun Prabhu <tarun@lanl.gov>
2026-05-19 10:55:47 +02:00
Jon Roelofs
2b92ab07b4
[clang] Enable crash reproducers when multiple -arch flags are involved (#197600)
rdar://176327788
2026-05-18 13:02:56 -07:00
Joseph Huber
a8e787ef54
[Clang] Permit vulkan as an OS for the SPIRV target architecture (#196101)
Summary:
This is currently rejected in two places, the toolchain creation and the
target itself. For the target we just permit it in the same way we alloe
things like 'amdhsa'. For the driver, the current handling just assumed
everything with 'vulkan' was HLSL. This shouldn't be true so we check
the source file type, and only push through actual HLSL files.

This is intended to more canonically support the 'CLSPV' target that
google has.
2026-05-07 08:42:42 -05:00
Mark Danial
6a9dac29a1
[AIX][Clang][Driver] Fix OBJECT_MODE bug on AIX (#193550)
If `--target` is specified it should take precedence over `OBJECT_MODE`.
This is important, for example, for lit tests which want to specify an
explicitly 32-bit or 64-bit triple on AIX, or they may get the wrong bit
mode depending on the environment they run in.
2026-05-06 09:48:21 -04:00
Matt Arsenault
bc2253a749
clang: Add BoundArch argument to ComputeEffectiveClangTriple (#195955)
This will eventually be used to adjust the amdgpu triple
to use subarches.
2026-05-05 22:46:14 +00:00
Matt Arsenault
fac6835137
clang: Print effective triple in -ccc-print-bindings (#195914)
Previously this would print the original triple, rather
than the adjusted triple for the tool invocation which I found
confusing.
2026-05-05 19:58:54 +00:00
Matt Arsenault
58f94f0a46
clang: Report full triple arch string in --offload-arch diagnostic (#195849)
This was previously only printing the top level arch string. Print
the full arch + subarch from the triple.
2026-05-05 13:31:03 +00:00
Matt Arsenault
bcd75cb494
clang: Fix using sm_52 as default subtarget for cuda spirv (#195369)
Copy what the HIP path does, except use "Unused" instead of "Generic".
Avoids assertions in future patch.
2026-05-01 22:37:25 +00:00
Matt Arsenault
4ff87c01c2
clang: Stop using replace_extension when there's no extension (#195335)
The offload case is building a fresh filepath and there's no file
extension to replace. Just directly append the file extension to avoid
clobbering part of the path name if the triple contains a period.

Avoids confusing test updates in future triple patch.
2026-05-01 20:30:03 +00:00
Naveen Seth Hanig
c1e78ed3d6
Reland "[clang][modules-driver] Add support for C++ named modules and import std" (2nd attempt) (#194475)
This reverts #193857 and relands #193312.

This adds basic support for explicit C++ named module builds, managed
natively by the Clang driver, including support for use of the Standard
library modules. This follows #187606, which adds the same for Clang
modules.

Current limitations:
- Standard library modules are still compiled to object files instead of
using the provided shared library. (This will be addressed in a
follow-up soon.)
- Caching is not supported yet (but likely to be added during the
upcoming GSoC cycle).
- Importing C++ standard library modules into Clang modules is not
supported (and not expected in the near term).

RFC:

https://discourse.llvm.org/t/rfc-modules-support-simple-c-20-modules-use-from-the-clang-driver-without-a-build-system
2026-04-28 01:58:00 +02:00
Naveen Seth Hanig
0bdcf4ee4d
Revert "Reapply "[clang][modules-driver] Add support for C++ named modules and import std" (#193857)
Reverts llvm/llvm-project#193815 due to a test failure
(`clang/test/Driver/modules-driver-import-std.cpp`) on some systems.
2026-04-24 01:19:53 +02:00
Naveen Seth Hanig
9473873906
Reapply "[clang][modules-driver] Add support for C++ named modules and import std" (#193815)
This reverts #193677 and relands #193312.

This adds basic support for explicit C++ named module builds, managed
natively by the Clang driver, including support for use of the Standard
library modules. This follows #187606, which adds the same for Clang
modules.

Current limitations:
- Standard library modules are still compiled to object files instead of
using the provided shared library. (This will be addressed in a
follow-up soon.)
- Caching is not supported yet (but likely to be added during the
upcoming GSoC cycle).
- Importing C++ standard library modules into Clang modules is not
supported (and not expected in the near term).

RFC:

https://discourse.llvm.org/t/rfc-modules-support-simple-c-20-modules-use-from-the-clang-driver-without-a-build-system
2026-04-24 00:46:21 +02:00
Matt Arsenault
3cd4a795d9
clang: Avoid hardcoding some offload triple strings (#193811)
This will make it easier to use the subarch field in the future.
2026-04-23 22:02:19 +01:00
Naveen Seth Hanig
582db3c237
Revert "[clang][modules-driver] Add support for C++ named modules and import std" (#193677)
Reverts llvm/llvm-project#193312 due to a failing test
(Driver/modules-driver-import-std.cpp)
2026-04-23 09:08:32 +02:00
Naveen Seth Hanig
739c45916d
[clang][modules-driver] Add support for C++ named modules and import std (#193312)
This patch adds basic support for explicit C++ named module builds,
managed natively by the Clang driver, including support for use of the
Standard library modules.

This follows #187606, which adds the same for Clang modules.

Current limitations:
- Standard library modules are still compiled to object files instead of
using the provided shared library. (This will be addressed in a
follow-up soon.)
- Caching is not supported yet (but likely to be added during the
upcoming GSoC cycle).
- Importing C++ standard library modules into Clang modules is not
supported (and not expected in the near term).

RFC:
https://discourse.llvm.org/t/rfc-modules-support-simple-c-20-modules-use-from-the-clang-driver-without-a-build-system
2026-04-23 06:44:33 +00:00
Pekka Jääskeläinen
27ff65192c
[OpenASIP] Update the TCE target defs for OpenASIP 2.2 (#176698)
OpenASIP (ex. TCE*) is a special target which has only a stub target
definition in the LLVM side that has resided in LLVM for over 15 years.
I'm the original contributors of this stub.

Due to needing various other patches to LLVM that were not nicely
upstreamable, the upstream TCE target defs have long been unupdated.
However, with the recent changes to the vectorization types etc. I
managed to minimize the required LLVM TCE patch to this one and with
this patch OpenASIP can be (finally!) used without a patched LLVM for
VLIW/TTA customization. RISC-V operation set customization still
requires a patch to polish and upstream (TBD).

This patch:

* Introduces a 64b variant of an OpenASIP target.
* Unifies the datalayouts of the different target variants to make it
compatible with OpenASIP v2.2 and above.
* Updates the OpenCL address space IDs to be compatible with the latest
PoCL backends.
* Implements Triple::computeDataLayout() for completeness.

The patch is very unintrusive and I'd love to backport it in the LLVM 22
release as well.

[*] More info:
https://blog.llvm.org/2010/06/tce-project-co-design-of-application.html
https://openasip.org

The actual backends for the customized processors are generated on the
fly with a backend generator of the OpenASIP project based on a target
definition file and loaded as plugins to the LLVM framework. This
mechanism enables fast "design space exploration" of
application-specific processors designed with the toolset as only a
small part of the compiler has to be regenerated for new design
candidates.
2026-04-15 11:54:24 -07:00
Lucas Chollet
934f795064
[clang] Add support for SerenityOS (#187941)
Adds support for the $arch-unknown-serenity target to the Clang front
end. This makes the compiler look for libraries and headers in the right
places, and enables some security mitigations like stack-smashing
protection and position-independent code by default.

----

A first attempt at upstreaming this patch was made
[here](https://reviews.llvm.org/D154396). I hope I fixed everything
mentioned there.

I intentionally kept `/usr/local/` in the default lookup path. I
consider it the more practical option, and I’d prefer to have the patch
merged as is and revisit the FIXME later. If this is absolutely
unacceptable to the maintainers, I will happily drop it and keep it as a
local patch until we address the underlying issue.

@MaskRay, @brad0 as you already reviewed the original patch.

---------

Co-authored-by: Daniel Bertalan <dani@danielbertalan.dev>
Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
Co-authored-by: Andrew Kaster <akaster@serenityos.org>
Co-authored-by: Dan Klishch <danilklishch@gmail.com>
2026-04-14 10:04:24 -07:00
Joshua Batista
46167f96bd
Add spirv-val compilation step when targeting SPIR-V (#188150)
Clang-dxc.exe currently uses dxv by default after compiling HLSL that
targets DXIL, assuming dxv can be found. However, there is no
counterpart for SPIR-V. This PR changes clang-dxc.exe so that the DXC
driver inserts a step to run spirv-val when SPIR-V is the target. It
also accounts for whether or not the -Fo option is passed. In all cases,
spirv-val will be run, as long as the target is SPIR-V and the spirv-val
executable can be found on the PATH.

This PR also adds a new option --spirv-val-path, a counterpart to
--dxv-path, for specifying an explicit path to spirv-val.

Key differences from dxv: Unlike dxv, which validates and signs DXIL
containers and produces an output file, spirv-val is a pure validator —
it checks the SPIR-V binary and exits with a status code without
producing output. Because of this, the compile step writes directly to
-Fo and spirv-val validates the file in-place.

Additional fixes:

- Fixes a duplicate "validator not found" warning that was emitted twice
per invocation — once from BuildActions and once from isLastJob (via
GetNamedOutputPath). This was a pre-existing bug introduced by #130436
(https://github.com/llvm/llvm-project/pull/130436). Fixed by
adding a Diagnose parameter to requiresValidation so only one call site
emits the diagnostic.
- Fixes an "unused argument" warning for -Vd when targeting SPIR-V,
caused by early returns in requiresValidation before the argument was
claimed.
- Adds a new SPIRVValidation diagnostic group and
warn_drv_dxc_missing_spirv_val diagnostic for the missing spirv-val
warning.

Fixes https://github.com/llvm/llvm-project/issues/142669

Assisted by: Claude Opus 4.6
2026-04-13 14:57:56 -07:00
hstk30-hw
1dc46a29cf
Clean Code. NFC (#191403) 2026-04-12 15:24:14 +08:00
Joseph Huber
be1bc283c6
[Clang] Permit '--target=amdgcn--' for binaries (#191451)
Summary:
We always accepted `--target=amdgcn--` to create IR object files but it
doesn't allow creating actual binaries without user intervention. This
is because it would fall-through to the GCC toolchain which does not
know how to handle AMGCN / AMDGPU targets. This PR just adds a single
line to handle it, which effectively allows this as a 'bare' target.

Perhaps the argument could be made that AMDGPU should not support
anything but strictly HSA because it has many assumptions in the
compiler itself, such as implicit arguments, but I feel like it is
relatively harmless to support this case if users decide they really do
not need it.
2026-04-10 12:01:14 -05:00