[clang][Driver]Fix opencl -cl-fast-relaxed-math flag to have similar behaviour as ffast-math (#208709)
Previously when using `-cl-fast-relaxed-math` flag along with
`fhonor-nans` or `fhonor-infinities` the honor flags did not override
the relaxed math flag. This behaviour is something that is not seen in
case of ffast-math for general targets.
This patch makes adjustments to how the driver and cc1 handles the
relaxed math flag for opencl. The flag was in the path of `fast-math` so
when someone used the `-cl-fast-relaxed-math` flag they were ultimately
overriding everything with fast-math. This was the main reason why honor
flags were not overriding relaxed math (atleast that's what I have
understood from my time working on this).
I have added tests for this as well and modified CodeGen cc1 tests
according to the changes in the patch.
I have personally not tested this on any AMD targets myself yet. So I am
unsure about this breaking anything (hopefully it should rather fix).
closes #178514
[libunwind][AArch64] Support .cfi_set_ra_state (#209950)
This new CFI directive directly assigns an RA signing state to the RA_SIGN_STATE DWARF pseudo-register for use when unwinding, to indicate whether the value of PC has been used as a diversifier for return address signing. The new directive subsumes and replaces .cfi_negate_ra_state_with_pc, which was found to be unsuitable for descibing some block layouts [1], particularly in hot-cold-split functions.
1: https://github.com/ARM-software/abi-aa/pull/346
[Clang] [Sema] Added a check for `NameInfo` not being empty after template instantiation (#210610)
Fixes #210234
As per my investigation (mostly following stack traces and dumping
variable values), a default empty `DeclarationNameInfo` was being
returned after template substitution [over
here](https://github.com/llvm/llvm-project/blob/c45b4e4d00bed488d6ece5608560561732ae5b9e/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp#L3270).
```cpp
// D-.>getNameInfo() has actual data here
DeclarationNameInfo NameInfo
= SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
// NameInfo has default values
```
This was being passed on directly to `CXXDestructorDecl::Create` leading
[3 lines not shown]
AMDGPU: Migrate assembler tests to subarch triples with error changes (#211592)
Since these cases dropped the -mcpu argument, the error messages changed
to use the canonical name.
[BoundsSafety] Introduce LateParsedAttrType AST placeholder type (#204125)
Split out from #179612 to make review easier. No functional change.
This introduces `LateParsedAttrType`, a new AST placeholder type used
during late parsing of type attributes. The actual late parsing
mechanism that uses this type is in #179612 and will be split into a
follow-up PR.
[acc] Refine launch-dim handling for sequential block-redundant ancestors (#211153)
Sequential `gpu_block_redundant` ancestors need selective launch-dim
handling in `getAncestorParDims`: including them always widens
gang-private to per-thread; omitting them always can predicate
block-redundant bodies on `blockIdx` after partition.
Include launch dims when the block-redundant loop is worksharing or is
the innermost parallel parent; skip them for an outer sequential
block-redundant wrapper around nested worksharing.
Fix ProcessELFCore::GetProcessInfo() to return expected results. (#210807)
Getting the process info from ProcessELFCore would always return the
information from the prpsinfo.pr_psargs from the NT_PRPSINFO. This meant
if the process was launched with a symlink, the process info would
always claim the main executable was the symlink. We want the process
info's executable to always be the resolved executable when possible.
The DynamicLoaderPOSIXDYLD was using the process info to load the main
executable if it wasn't set, or it was comparing if the main
executable's module spec matched the process info, and if it didn't
match it would end up trying to load the main executable using the
process info. We also ask for the UUID from the process before trying to
use the process info to replace the executable in
DynamicLoaderPOSIXDYLD::ResolveExecutableModule().
[AMDGPU] Consult AA for non-atomic clobbers in isReallyAClobber
isReallyAClobber (used by AMDGPUAnnotateUniformValues to decide whether a uniform
load may be marked !amdgpu.noclobber) only queried alias analysis for atomics;
every other memory-writing MemoryDef (plain stores, memory intrinsics, calls)
fell through to an unconditional "return true", declaring it a clobber without
asking AA.
As a result a uniform, read-only load is denied !amdgpu.noclobber whenever
MemorySSA's clobber walk surfaces such a def through a loop MemoryPhi, even when
AA can trivially prove NoAlias (e.g. an LDS/addrspace(3) write vs a
global/addrspace(1) load). Without noclobber the load is selected as a vector
GLOBAL_LOAD instead of a scalar s_load, adding a v_readfirstlane round-trip when
the value feeds a scalar operand.
Query AA generally via getModRefInfo for the fall-through case, while keeping the
fence/barrier whitelist and the pointer-level atomic special case (getModRefInfo
over-reports Mod for an atomic's ordering effects). The load's MemoryLocation is
threaded through so addressing/size precision applies.
[NVPTX] Lower allocas to the local address space (#204346)
Alternative to #201772.
When SelectionDAG expands a small memcpy/memmove/memset it can raise the
alignment of the
destination stack object, but only when the destination is a bare
FrameIndex. Since #121710,
NVPTX treats allocas as assumed-local, and InferAddressSpaces rewrites
the intrinsic
operands to addrspacecasts. ISel no longer sees the frame index, the
alignment isn't raised,
and small unaligned copies are expanded byte-by-byte. We observed up to
1.9x slower kernels
in JuliaGPU/CUDA.jl#3162.
#201772 fixed this in SelectionDAG by looking through addrspacecasts to
recover the stack
object. Per review feedback there, this PR takes a different approach:
[39 lines not shown]
[clang][test] Add Darwin pragma weak alias IR coverage (#211499)
Add Clang IR coverage for `#pragma weak alias = target` on Darwin.
The test verifies that Clang:
- emits the alias with weak linkage;
- keeps calls referencing the alias instead of replacing them with the
aliasee.
This is a test-only follow-up to #198148 and covers the Clang lowering
path used by #111321.
Clarify metadirective local DSA check
- Evaluate non-static locals directly where references under DEFAULT(NONE) are
checked.
- Keep using the ultimate symbol so a nested data-sharing clause other than
PRIVATE still creates the required reference in the enclosing construct.
llvm-mca: Stop defaulting to "native" for the CPU (#211612)
This would warn whenever using a triple that isn't for the host
architecture. Other tools don't do this. Copy what llc does and
default to no cpu.
[flang][OpenMP] Switch TableGen generation to use llvm::EnumSet
Replace the remaining uses of the common::EnumSet-based OmpClauseSet to
llvm::omp::ClauseSet.
Specialize IterateOverMembers instead of ClauseSetToString
There was still a use of common::EnumSet::IterateOverMembers left
over after the prior changes. Get rid of it via the specialization,
and revert the specialization of ClauseSetToString, which was
originally implemented using IterateOverMembers.
[flang] Provide "clause set" type as parameter to DirectiveStructureChecker
This will remove the hardcoded dependence of DirectiveStructureChecker on
the common::EnumSet class. Both consumers of it will be able to use their
own type for the clause set.
The only complication was the ClauseSetToString member function, whose
implementation depended on the specifics of common::EnumSet, namely the
IterateOverMembers member function. It was moved out of the class, and
turned into a function template to make it possible to provide different
specializations for common::EnumSet and llvm::EnumSet.
[flang][OpenMP] Use llvm::omp::DirectiveSet instead of common::EnumSet
Replace uses of OmpDirectiveSet (defined in terms of common::EnumSet)
with the common llvm::omp::DirectiveSet (defined via llvm::EnumSet).
The llvm::omp::DirectiveSet class will also be used in openmp-parsers,
where OmpDirectiveSet was an instance of llvm::Bitset.
[flang][OpenMP] Use llvm::omp::ClauseSet instead of common::EnumSet
Replace uses of OmpClauseSet (defined in terms of common::EnumSet)
with the common llvm::omp::ClauseSet (defined via llvm::EnumSet).
[OpenMP] Implement EnumSet container
This is close to flang's common::EnumSet with the difference being that
it provides forward iterators.
The reason for having an implementation that is separate from
common::EnumSet is that this is intended to be shared for all consumers
of llvm/lib/Frontend/OpenMP. This class is also planned to be one of the
core containers for representing auto-generated OpenMP data in the future.