[Clang][Sema] Error message refers to `__begin1` with `constexpr` variable in range-based for loop (#218145)
Fixes #211926
When a range-based for loop variable is declared `constexpr`, its
initializer is the compiler-built `*__begin1`, which normally can't be a
constant expression. The constant evaluator reports what it sees at the
leaf — `read of non-constexpr variable '__begin1' is not allowed in a
constant expression`, plus a `declared here` note pointing at the loop's
colon — without saying what `__begin1` is.
Both constant evaluators now emit a single dedicated note when they read
one of the loop's implicit variables, so the existing `constexpr
variable 'x' must be initialized by a constant expression` error is
followed by `'__begin1'-variable of range-based 'for' loop is not a
constant expression`, pointed at the loop it belongs to. The note takes
the variable as an argument, so it names `__end1` or `__range1` when
those are what was read. No Sema changes. A constexpr loop variable that
*is* valid (CWG1204, when `operator*` never reads the iterator) still
[4 lines not shown]
[MLIR][CMake] Remove aggregate generated-header ordering
Remove the broad mlir-headers prerequisites now that direct links and
HEADER_LIBS relationships provide generated-header ordering.
Keep own generators and intentional source-generation dependencies explicit.
Document migration options for downstream projects that relied on aggregate
ordering.
Assisted-by: Codex
Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[MLIR][CMake] Add HEADER_LIBS and document CMake infrastructure
Add HEADER_LIBS as a flat list of literal library targets for generated headers
included without a link relationship. Resolve aliases and forward references,
accept imported libraries as already generated, follow nested HEADER_LIBS and
link interfaces, and reject missing, executable, utility, or generator-
expression entries with configure-time diagnostics. Represent header-only
edges in the common internal INTERFACE graph, including cyclic relationships.
Record links added by mlir_target_link_libraries for the same deferred ordering.
Add explicit, commented HEADER_LIBS edges for every audited header-only include
that is not covered by mlir-generic-headers, and keep this facility a rare
layering escape hatch.
Document dialects, interfaces, passes, PDLL, generated documentation, library
visibility, C API aggregation, tools, exports, standalone consumers, and the
generated-file model. Add a CMake fixture covering cycles, aliases, conditions,
LINK_ONLY, imported and ignored items, post-hoc links, and invalid providers.
Build each consumer independently from a clean state to verify transitive
[5 lines not shown]
[CMake] Propagate generated-header prerequisites through link dependencies
The goal is to simplify and make more robust the handling of generated-header
(TableGen) dependencies. Today these dependencies are managed manually, which
is fragile: missing edges often surface only in parallel builds, and sometimes
in incremental builds.
Record each llvm_add_library DEPENDS list independently from the cumulative
LLVM_COMMON_DEPENDS value, and mark public TableGen targets as generated-header
prerequisites. A deferred traversal follows every direct non-INTERFACE link and
transitive link interface, resolves aliases, and conservatively extracts target
candidates from generator expressions.
Represent generated-header prerequisites with internal INTERFACE libraries.
Let CMake propagate their utility dependencies through the header graph, and
reuse each provider's interface to handle cycles without computing closures.
Disabled generator-expression arms may generate extra headers, but cannot
introduce a provider library or object cycle.
[10 lines not shown]
[InstCombine] Prepare to support trunc nuw condition in foldAndOrOfICmps (NFC) (#221555)
this is a NFC rewrite to be able to support Trunc nuw by using m_IcmpLike matcher in foldAndOrOfICmps
[VPlan][Predicator] Preserve some uniform control flow
Implements "Partial Control-Flow Linearization" by Simon Moll and
Sebastian Hack.
That should allow implementation of an alternative to
https://github.com/llvm/llvm-project/pull/141900 based on this
functionality (see BOSCC in the paper).
[DAGCombiner] Use canonical shift amount type when decomposing a multiply. (#222211)
This allows the shifts to CSE with other shifts that are already in
canonical form.
[VPlan] Use compact RPOT instead of just RPOT
This is necessary for the future partial linearization change, but I
wanted to commit this bit independently because it changes some tests on
itself and could potentially provide more blend optimization
opportunites (at least I hoped) but that didn't seem to happen.
[VPlan] Make blend operands non-reorderable to optimize their masks in predicator
Sort the incoming edges according to RPOT order so that we could use
simpler source block mask instead of the edge mask.
[SystemZ] XPLINK64: use AExt for 32-bit pointer formals (#222350)
CC_XPLINK64_Pointer was setting LocInfo=ZExt, promising the optimizer
that the caller had zero-extended bit 32. Evidence from Open XL 1.1 and
2.2 shows that callers do not consistently zero-extend `__ptr32`
arguments
-- Open XL 1.1 emits nothing on the caller side; Open XL 2.2 only
zero-extends in the explicit cast case. Every actual use of a 31-bit
pointer goes through `addrspacecast` which emits `LLGTR` to clear bit 32
at
the point of use, so no callee relies on the register being clean at the
parameter boundary. Change LocInfo to AExt to accurately reflect that
only the low 32 bits are valid.
Extracted from #206833 per reviewer request.