[flang][openmp] Write to clause to modfile (#213936)
Fix bug where the list of variables would be ignored when writing the
to clause of a declare target directive to a modfile.
[AMDGPU] Do not fold add chains wider than 32 bits into dot4 (#216015)
dot4 always produces a 32-bit result, so folding a wider accumulator
would silently drop its upper bits
[flang][Parser][NFC] Don't build a discarded list while scanning identifiers (#219330)
```c++
constexpr auto rawName{nonDigitIdChar >> many(nonDigitIdChar || digit)};
TYPE_PARSER(space >> sourced(rawName >> construct<Name>()))
```
`many()` has resultType `std::list<const char *>`, so scanning an
identifier heap-allocates one node per character after the first -- the
leading `nonDigitIdChar` is outside `many()`. The `>>` operator discards
its left operand's value, so that list is destroyed unread; `sourced()`
recovers the text from the cursor span instead. Backtracking rescans
identifiers, so CloverLeaf_Serial (401KB) does 3.9M unnecessary
allocations.
Fix: use `skipMany`, documented as "equivalent to many(x) but with no
result", with the same `BacktrackingParser` wrapper. -0.88%
instructions:u; emitted code byte-identical with CloverLeaf_Serial.
Use explicit `operator==` call for `DenseMapInfo<mlir::TypeRange>` to avoid `C++20 says that these are ambiguous, even though the second is reversed` warning (#218713)
Fix https://github.com/llvm/llvm-project/issues/81769
WIP preserve move uniform cfg, BROKEN
Masks for blends originated from preserved CFG are `true` which is wrong
with the current algorithm, see blend_masks_triangle_phi in
predicator.ll
[libc][math] Implement single precision lgamma function (#205490)
The implementation reduces to `|x|` and selects a path:
- **Tiny** ($|x| < 2^{-23}$): truncated Laurent series $\text{lgamma}(x)
= -\log|x| - \gamma\,|x|$.
- **Small** ($|x| < 0.66$): a centered-monomial minimax fit (degree 17
for $x>0$, degree 25 for $x<0$) of the smooth quotient $g(x) =
\frac{\text{lgamma}(x) + \log|x|}{x}$, recovering $\text{lgamma}(x) =
x\cdot g(x) - \log|x|$ with a single FMA rounding.
- **Medium** ($|x| \in [0.66, 3.37]$): centered-monomial minimax fits
split into three sub-ranges that factor out the function's roots —
- $[0.66, 1)$: $\text{lgamma}(t) = (t-1)\,P(t)$ (degree 14)
- $[1, 2)$: $\text{lgamma}(t) = (t-1)(t-2)\,P(t)$ (degree 18)
- $[2, 3.37)$: $\text{lgamma}(t) = (t-2)\,P(t)$ (degree 15)
- **Stirling** ($|x| > 3.37$): $(x-0.5)(\log x - 1) +
\frac{\log(2\pi)}{2} - \tfrac12$ plus a $1/x$ Bernoulli correction whose
term count is selected by sub-range (degree-10 residual poly on $(3.37,
73]$; 4-term, then 2-term; dropped entirely for $|x| > 2^{20}$).
[42 lines not shown]
[VPlan][Predicator] Preserve some uniform control flow
Implements "Partial Control-Flow Linearization" by Simon Moll and
Sebastian Hack. Does **NOT** improve predication/masking yet, so
applicability is artificially narrowed, only some uniform branches are
preserved. In particular, the following is left for future PRs:
* Block masks still contains now-unnecessary term for the preserved
uniform branches.
* Mixed blends/phis aren't supported yet. Detecting where they would be
necessary is as complex as implementing proper support (which would
need either Luke's `reconstructSSA` or Iterated Dominance Frontier),
so we also limit it to a trivial/structured CFG where there's only
single block where those would need to be inserted.
I think even the current version might be enough to start implementing
an alternative to https://github.com/llvm/llvm-project/pull/141900 (see
BOSCC in the paper).
[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.