[SSAF][PointerFlowExtractor] Handle empty initializer lists for scalars and unions (#201968)
Empty initializer lists for scalars and unions are corner cases that
were previously missed by the PointerFlowExtractor. This commit adds
support for these cases. Because the initializing values are implicitly
constant 0 (or nullptr), they do not bridge entity pointer levels.
rdar://178856689
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[mlir][vector][NFC] Document and simplify vector contract reshape helpers (#200544)
Replace the bare `// TODO` placeholders above `reshapeLoad` and
`reshapeStore`
in `LowerVectorContract.cpp` with doc comments describing each helper's
semantics (the `index == -1` / `index == 0` / `index > 0` cases) and
short
before/after IR examples.
Also drop the redundant `VectorType` parameter from both helpers; the
type is
now inferred from the value operand (`val` for `reshapeLoad`, `result`
for
`reshapeStore`).
Add a LIT test that exercises the recursive `reshapeLoad` unroll path by
mapping a parallel iterator to a non-leading dimension, which falls
through
to the generic `lowerParallel` / `reshapeLoad` path.
[5 lines not shown]
[SSAF][Extractor] Make hard errors in PointerFlow and UnsafeBufferUsage Extractors quiet (#201953)
Hard errors were used in extractors during development to quickly
identify unsupported language constructs. This commit converts them to
DEBUG_WITH_TYPE so that these errors are silenced in release builds.
In addition, translating unsupported language constructs now silently
results in an empty EntityPointerLevelSet. The PointerFlowExtractor will
skip empty sets for either the source or the destination when building
edges to avoid an ill-formed edge set data structure.
rdar://178747892
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[libc++] Reimplement `optional<T&>` as a partial specialization (#201983)
- Break out the `optional<T&>` implementation that was interwoven with
the regular interface
- This should simplify the implementation
- And fix a missed added constraint for the `std::swap` specialization.
[NFC][DirectX][SPIRV] Remove helper from HLSLFrontend (#203401)
Remove helper function `removeCBufferGlobalsFromUseList` which basically
implements existing `llvm::removeFromUsedLists`. Modify the passes that
use it to call `llvm::removeFromUsedLists`.
Follow-up on
https://github.com/llvm/llvm-project/pull/202745#discussion_r3398119720
[lldb][macosx] Pare down the SimulatPlatform tests, don't run on intel (#203417)
TestSimulatorPlatform.py is flakey on the Intel Mac CI, doing a
'platform process list' and not getting a reply back. The issue is only
happening on the old Intel mac CI and not the newer arm64 CI's; it is
not important. I am skipping this test on the Intel mac CI.
I'm also removing test runs that try to build 32-bit binaries (i386,
armv7k) and the tests that would explicitly test for a legacy build load
command (e.g. `LC_VERSION_MIN_IPHONEOS`); we don't support building back
to when OSes were using those, any more.
[CIR] Lower sret returns in CallConvLowering (#201716)
Functions that return an aggregate by value classify their return as
ArgKind::Indirect, but CallConvLowering reached an errorNYI for that
case, so the whole CallConv pass refused to lower any struct-returning
function.
rewriteFunctionDefinition now recognizes an Indirect return: the wire
return type becomes void, a hidden sret pointer is prepended as block
argument 0, and every cir.return is routed through that pointer. Rather
than storing the loaded return value through the sret pointer (a
byte-copy that breaks non-trivially-copyable types -- libstdc++'s SSO
std::string keeps a _M_p pointer into its own _M_local_buf, so a
byte-copy leaves the destination aliasing the source's dying stack
storage), insertSRetStores rewires the __retval alloca to the sret
pointer so construction flows directly into the caller's slot, matching
classic CodeGen's "construct into %agg.result" pattern. CIRGen emits one
cir.load __retval / cir.return pair per return statement, all reading
the
[25 lines not shown]
[libc] restrict FreeTrie to the overflow bin in TLSF
- Rename config option to USE_TRIE_FOR_OVERFLOW_BIN.
- Restrict FreeTrie usage to only the last overflow bin (bit_index == TOTAL_BITS - 1).
- Simplify exact fit search to only use FreeList, as large sizes now always go to the overflow bin.
- Simplify away index_to_range by using a fixed [0, INF) range for the overflow Trie.
- Remove index argument from Trie helper functions as they only operate on the overflow bin.
TAG=agy
CONV=fe3b4efa-7a5b-4c74-8257-e53f0d6e4850
[libc] restrict FreeTrie to the overflow bin in TLSF
- Rename config option to USE_TRIE_FOR_OVERFLOW_BIN.
- Restrict FreeTrie usage to only the last overflow bin (bit_index == TOTAL_BITS - 1).
- Simplify exact fit search to only use FreeList, as large sizes now always go to the overflow bin.
- Simplify away index_to_range by calculating overflow bin range via constexpr safe helper.
- Remove index argument from Trie helper functions as they only operate on the overflow bin.
TAG=agy
CONV=fe3b4efa-7a5b-4c74-8257-e53f0d6e4850
[CIR] NFC: Drop redundant llvm:: qualifiers in sret lowering
Restore `using namespace mlir;` in CIRABIRewriteContext.cpp so the LLVM
ADT names re-exported into the mlir namespace (SmallVector, ArrayRef,
StringRef, SmallPtrSet, function_ref) are in scope without an explicit
llvm:: qualifier. An earlier review fixup had removed the directive and
qualified every ADT type with llvm::, over-applying the qualifier to
unambiguous names.
llvm:: is kept on the free functions mlir does not re-export (enumerate,
any_of, append_range), and mlir:: stays explicit on MLIR types. No
functional change.
[flang] Improve error for data component definition after CONTAINS in derived type (#203379)
When a data component declaration appears after CONTAINS in a derived
type definition, flang previously emitted confusing "expected 'FINAL'",
"expected 'GENERIC'", and "expected 'PROCEDURE'" errors for each
misplaced component.
This patch adds a misplaced-component detector following the same
pattern as `misplacedSpecificationStmt` in program-parsers.cpp.
DataComponentDefStmt is tried as a last alternative in
TypeBoundProcBinding's first(). When it matches, fail<>() fires
with the message:
error: component definition must precede CONTAINS in a derived type
CombineFailedParses then replaces the three keyword-mismatch messages
with this single targeted one, since the component parse advances
further than the PROCEDURE/GENERIC/FINAL failures.
Assisted-By: AI
[libc] Add timezone extensions to struct tm and time.h (#203381)
Added timezone extensions to struct tm and time.h:
* struct tm: Added tm_gmtoff and tm_zone, with __tm_gmtoff and __tm_zone
aliases defined as macros.
* time.h: Added tm_gmtoff_t type.
Updated gmtime and localtime to initialize these fields, and enabled %z
and %Z support in strftime.
These changes are implemented unconditionally. While the timezone
database loading is not yet implemented (so local time offsets default
to UTC/0), the timezone formatting and struct field support is fully
complete. Implementing this conditionally would require complex
build-time configuration and conditional inclusion of code, which is
avoided as this implementation is already a complete improvement over
the previous state.
Assisted-by: Automated tooling, human reviewed.
[VPlan] Account for canonical IV being simplified in verifier. (#203403)
In plain CFG plans, VPCurrentIterationPHIRecipe may be the first recipe,
if the canonical IV phi has been removed because it became unused (e.g.
the vector loop is known to only execute a single iteration).
Fixes https://lab.llvm.org/buildbot/#/builders/187/builds/20801.