[lldb] Use llvm::sys::RWMutex instead of std::shared_mutex (NFC) (#197847)
On Darwin, pthread_rwlock is faster than std::shared_mutex, which is why
the implementation of llvm::sys::RWMutex used that on our platform.
Everywhere else, it uses std::shared_mutex under the hood.
Also see #70151
rdar://177113951
[Bazel] Port ca6e386cbf5b3e75a2a62e6c4d29b24109727a52 (#197841)
obj2yaml now depends on MC (although probably not for much), and remove
an unnecessary header creating a layering violation.
[Flang][OpenMP][Offload] Modify MapInfoFinalization to handle attach mapping and 6.1's ref_* and attach map keywords (#177715)
This PR is one of four required to implement the attach mapping
semantics in Flang, alongside the ref_ptr/ref_ptee/ref_ptr_ptee map
modifiers and the attach(always/never/auto) modifiers.
This PR is the MapInfoFinalization changes required to support these
features, it mainly deals with applying the correct attach map type and
manipulating the descriptor types maps for base address and descriptor
so that when we specify ref_ptr/ref_ptee we emit one of the two maps and
when we emit ref_ptr_ptee we emit our usual default maps. In all cases
we add the "glue" of an new attach map except in cases where a user has
provided attach never. In cases where we are provided an always, we
apply the always map type to our attach maps.
It's important to note the runtime has a toggle for the auto map
behavior, which will flip the attach behavior to the newer semantics or
the older semantics for backwards compatibility (outside the purview of
this PR but good to mention).
[LifetimeSafety] Recognize declarations nested under std namespace (#197604)
Previously `isInStlNamespace()` only checked the immediate declaration
context. This missed declarations nested below `std` through records or
intermediate namespaces, such as `std::basic_string_view` constructors.
This commit fixes the problem by walking the `DeclContext` chain in
`isInStlNamespace`.
Closes #197454
[OpenMP][MLIR] Modify OpenMP Dialect lowering to support attach mapping (#179023)
This PR adjusts the LLVM-IR lowering to support the new attach map type
that the runtime uses to link data and pointer together, this swaps the
mapping from the older OMP_MAP_PTR_AND_OBJ map type in most cases and
allows slightly more complicated ref_ptr/ptee and attach semantics.
[clang][NFC] Remove `macro_begin` and `macro_end` from `Preprocessor` (#197817)
Use `macros()` wherever posible. This gives us the following advantages:
1. We can use the range-base for loop for simpler looking code.
2. We more ergonomically use algorithms.
3. We can avoid the duplicate work of checking if we need to call
`ExternalSource->ReadDefinedMacros()` that was in both `macro_begin` and
`macro_end`. In some cases, we save this extra work once per loop
iteration, not just one extra total.
4. No user confusion deciding which version they should call
5. Reduce the size of `Preprocessor.h` and the number of members in
`Preprocessor`.
Using `macros` ends up being the better solution in every case, so since
all callers were migrated from `macro_begin` and `macro_end` to
`macros`, get rid of `macro_begin` and `macro_end`.
---------
Co-authored-by: Victor Chernyakin <chernyakin.victor.j at outlook.com>
[lldb][Clang] Removed redundant code in DWARFASTParserClang (#197802)
decl_up is initialized here but doesn't appear to be used or moved
anywhere before it goes out of scope. If the Declaration info isn't
needed for the FunctionSP, it should probably be removed.
[clang] Implement constexpr DesignatedInitUpdateExpr. (#196427)
DesignatedInitUpdateExpr exists to handle some obscure edge cases in C,
where the usual InitListExpr canonicalization can't be performed.
Previously, we didn't need constant evaluation for this, but C23
constexpr means we need to evaluate this before codegen.
Implementation is mostly straightforward: just need to evaluate the two
subexpressions, in order, and skip any NoInitExprs.
Along the way, I ran into an issue with the way we manage array APValues
for non-bytecode constant evaluation; fix reallocation to work
correctly.
Fixes #193373. Fixes #196450.
[Flang][MLIR][OpenMP] Add distinct var_ptr_ptr_type to omp.map.info operations & remove ref_ptr_ptee (#177302)
This is a precursor patch to attach and ref_ptr/ptee mapping that I
intend to upstream
over the next few weeks. The attach maps require both the type of the
descriptor and
the pointed to data to calculate the appropriate offload/base pointers
and size. In
the base case of ref_ptr_ptee all of this information can be gathered
from the pointer
and pointee maps, but in cases where we have only one (i.e.
ref_ptr/ref_ptee) we will
be missing one of the key elements required to create an corresponding
attach map.
So, this PR basically adds the ability to ferry around the type of both
var_ptr and
var_ptr_ptr as opposed to just var_ptr, then we can emit attach maps as
seperate
[8 lines not shown]
[Flang][OpenMP][MLIR] Add attach and ref map type lowering to MLIR (#177301)
This doesn't implement the functionality, just the relevant map type
lowering to MLIR's omp.map.info. The more complicated changes to
MapInfoFinalizationPass.cpp and OpenMPTOLLVMIRTranslation.cpp to support
attach map and the various ref/attach semantics will come in a
subsequent set of PRs. This just helps compartmentalize the changeset.
Reland "[DirectX][ObjectYAML] Add ILDN part support" (#197749)
This relands #194508, which was reverted in #197348.
This reland addresses the revert reasons:
- Rename `DXContainerYAML::DebugName::DebugName` to `Filename` to avoid
compilation failures on older `cl.exe` versions due to field name
matching
its class name.
- Fix layering by reverting the MC -> Object dependency introduced
previously:
`ILDNData` is no longer defined in `llvm/Object/DXContainer.h` and used
by MC. Instead, ILDN fields are represented by `mcdxbc::DebugName` in
`llvm/MC/DXContainerInfo.h`, and Object uses that type (Object already
depends on MC).
[AArch64] Make width of stack protector guard value load configurable. (#195379)
Certain embedded targets store the value of the stack protector global
in an MMIO register, which requires a load of a specific width. Allow
changing the backend to emit a 4-byte load for the value of the stack
protector, instead of an 8-byte load. (Or vice versa for an ilp32
target.)
The current version of the patch has a limitation: it still allocates a
pointer-sized stack slot for the guard. This could be fixed in the
future, if it becomes relevant.
[lldb] Use identity hashing for HashToISAMap in ObjCLanguageRuntime (#197759)
The keys of HashToISAMap are already hashes, and can be used as-is.
---------
Co-authored-by: Adrian Prantl <adrian.prantl at gmail.com>
[MIR] Save internal VirtRegMap state
Adds two optional fields to the per-vreg YAML record so MIR tests can
express VirtRegMap state that previously had no representation:
registers:
- { id: 1, class: vgpr_32, split-from: '%0', assigned-phys: '$vgpr5' }
Testing passes that consume sibling-register information (e.g.
InlineSpiller) requires constructing a VirtRegMap with split
relationships from a MIR test, which implies triggering live-range
splitting at minimum and make reproducers unnecessarily complicated.
So this change introduces a mechanism to serialize/deserialize the state
of the VirtRegMap pass.
Mechanism:
- For serialization:
- MIRPrinter emits the new fields only when the VirtRegMap is available.
[13 lines not shown]
[MIR] Serialize/Deserialize MachineInstr::LRSplit attribute
The LRSplit MachineInstr flag is set by SplitKit on copies inserted for
live-range splitting.
Until now the flag had no MIR-text representation.
This patch fixes that so that it gets easier to reproduce/capture issues
that involves SplitKit.
Round-trip coverage in
llvm/test/CodeGen/MIR/AMDGPU/lr-split-flag.mir.
[AMDGPU][test] Use mir test for regalloc issue
Use the newly introduced split-from flag to produce a more robust test case
for the hoistSpillInsideBB live-range update issue.
NFC
Allow ObjC writeback conversion in cleanup attribute type check (#195318)
Prior to #164440, CheckAssignmentConstraints in the cleanup attribute
handler ran before ObjC lifetime qualifiers were inferred on the
variable. It compared against a type without '__strong' and accepted
both 'T **' to 'T *__autoreleasing *' and 'T **' to 'T
*__unsafe_unretained *'. #164440 reversed the order, so the check now
runs after '__strong' is inferred and rejects both 'T *__strong *' to 'T
*__autoreleasing *' and 'T *__strong *' to
'T *__unsafe_unretained *'.
Fix the valid case by falling back to isObjCWritebackConversion when the
assignment check fails. This re-allows the '__strong' to
'__autoreleasing' writeback conversion while continuing to reject
'__strong' to '__unsafe_unretained'.
rdar://175133715
[flang][docs][nfc] Wordsmith -frelaxed-c-loc-checks flag description (#197804)
Clarify that unexpected behavior reflects the compiler's design choice
not to track aliases from non-target non-pointer C_LOC() arguments,
rather than implying a compiler defect. Align phrasing across
FlangOptions.td and Extensions.md.
Also add the `-checks` suffix to the flag per @sscalpone's suggestion.