[X86] min-legal-vector-width.ll - update PMADDWD tests to more closely match middle-end vector.reduce.add codegen (#199061)
Matches what we've already done in madd.ll
Optimization on predecessor count checks for FunctionPropertiesAnalysis (#198940)
It used to need to get the whole bb predecessor count and then check
with the size of it. That needed to go through the whole list only to
check against 1, 2 or 3. By using its already existing basic block
predecessor count function, these attributes can be counted much faster.
Now it doesn't need to go through the whole list. The moment it gets to
the 3rd element, no matter how many predecessors there might be, we have
our answer for the metrics
[DirectX][ObjectYAML] Fix name conflict in DXContainerYAML.h (#199062)
After https://github.com/llvm/llvm-project/pull/198222, GCC with
`-fpermissive` reports an error:
```
llvm/include/llvm/ObjectYAML/DXContainerYAML.h:328:34: error: declaration of ‘std::optional<llvm::DXContainerYAML::CompilerVersion> llvm::DXContainerYAML::Part::CompilerVersion’ changes meaning of ‘CompilerVersion’ [-Wchanges-meaning]
328 | std::optional<CompilerVersion> CompilerVersion;
```
Fix that.
[Clang][Parser] Report error when attribute missing ]] followed by ;; (#187580)
Report error when attribute missing enclosing `]] `followed by `;;`
Fixes: #187223
clang: Refactor handling of offload sanitizer arguments (#196737)
Previously the AMDGPU toolchains hackily handled -fsanitize arguments.
They would lie and report that all host side sanitizers are available,
then TranslateArgs would filter out the device side cases that do not
work, providing diagnostics for the skipped cases. Move that logic
into the base sanitizer argument parsing.
This makes the produced diagnostics more consistent. Previously we
would get repeated warnings when a sanitizer is fully unsupported
by amdgpu, which should now be once for the toolchain. These could
be further improved; we're printing the specific field of -fsanitize
in more cases where it could be skipped. In other cases we have the
opposite problem, where we aren't reporting the exact sanitizer
from the -f flag in the case that depends on a subtarget feature.
This will help fix other broken target specific flag forwarding bugs
in the future.
Co-authored-by: Claude Sonnet 4 <noreply at anthropic.com>
[CIR] Fix problem with multiple references to an alloca in a cleanup (#198928)
A recent change to hoist allocas out of a deferred cleanup scope had a
bug wherein if multiple entries in the deferred cleanup stack referenced
the same alloca, the second attempt to see if it needed to be hoisted
would assert in the MLIR region code. This was happening because when we
hoist the alloca, we hoist it to a block that is still under
construction. On the second encounter when we're walking its parent
chain to see if it is contained within the cleanup scope we're
processing, our call to get the parent region of the block containing
the alloca would assert because the alloca is in an unlinked block (it
gets added to a region after we're done constructing it).
To fix this problem, I changed the way we're checking for the alloca
being nested within the cleanup scope, using a more robust
implementation that will tolerate encountering unlinked operations.
Assisted-by: Cursor / claude-opus-4.7-thinking-xhigh
clang/AMDGPU: Use TranslateArgs from the base toolchain instead of the host
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.
clang: Refactor handling of offload sanitizer arguments
Previously the AMDGPU toolchains hackily handled -fsanitize arguments.
They would lie and report that all host side sanitizers are available,
then TranslateArgs would filter out the device side cases that do not
work, providing diagnostics for the skipped cases. Move that logic
into the base sanitizer argument parsing.
This makes the produced diagnostics more consistent. Previously we
would get repeated warnings when a sanitizer is fully unsupported
by amdgpu, which should now be once for the toolchain. These could
be further improved; we're printing the specific field of -fsanitize
in more cases where it could be skipped. In other cases we have the
opposite problem, where we aren't reporting the exact sanitizer
from the -f flag in the case that depends on a subtarget feature.
This will help fix other broken target specific flag forwarding bugs
in the future.
Co-authored-by: Claude Sonnet 4 <noreply at anthropic.com>
clang: Add BoundArch/OffloadKind argument to getSupportedSanitizers (#196503)
Currently the AMDGPU HIP and OpenMP toolchains falsely report
all host sanitizers are supported, and then go out of their way
to skip forwarding those to the device compiles. Add an offloading
kind argument so that in the future this can be handled in one
place in the base toolchain.
Co-authored-by: Claude Sonnet 4 <noreply at anthropic.com>