InstCombine: Add more tests for min/max SimplifyDemandedFPClass
Test some more refined cases, such as ordering with 0s and within
known positive and known negative cases.
InstCombine: Improve SimplifyDemandedFPClass min/max handling
Refine handling of minimum/maximum and minimumnum/maximumnum. The
previous folds to input were based on sign bit checks. This was too
conservative with 0s. This can now consider -0 as less than or equal
to +0 as appropriate, account for nsz. It additionally can handle
cases like one half is known positive normal and the other subnormal.
ADT: Add utility functions for comparing FPClassTest
Add utility functions for checking if less and greater queries
are known to not evaluate to true. This will permit more precise
folding of min/max intrinsics. The test is kind of a mess.
[clang] Add a valid begin source location for abbreviated function templates (#174723)
The begin source location for function templates is determined by the
source location of the template keyword.
Pure abbreviated function templates do not have the template keyword.
This results in an invalid begin source location for abbreviated
function templates.
Without a valid begin source location, comments cannot be attached to
the function template which leads to the bug described in
clangd/clangd#2565.
This patch introduces new begin locations for abbreviated function
templates (begin of the templated function) and generic lambdas (begin
of the introducer `[...]`) when creating the template parameter lists in
Sema.
Control spacing for attribute printing (#174197)
This was motivated by the decl printing for the alignas() keyword
attribute:
class alignas(1) Foo;
would be printed as:
class alignas(1) Foo;
with two spaces before class name.
Rather than trying to help `prettyPrintAttributes` guess what the caller
wants in terms of leading and trailing spaces, have it return an
`optional<string>` which is either the pretty-printed attributes for
Pos,
or `nullopt` if no attributes were found.
[3 lines not shown]
[MLIR][Python] Register `OpAttributeMap` as `Mapping` for `match` compatibility (#174292)
This is a continuation of the idea from #174091 to add `match` support
for MLIR containers. In this PR the `OpAttributeMap` container is
registered as a `Mapping`, so be mapped as a "dictionary" in `match`
statements.
For this to work the `get(key, default=None)` method had to be
implemented. Those are pretty much copys of `dunderGetItemNamed` and
`dunderGetItemIndexed` with an added argument and `nb::object` as return
type, because they can now return other types than just `PyAttribute`.
Was unsure if I should refactor this to make `dunderGetItem...` use the
new `getWithDefault...` or if a separate method is preferred. Kept it as
a copy for simplicitys sake for now.
Even though the `OpAttributeMap` supports indexing by `int` and `str`,
Python does not allow to register it as a `Sequence` and a `Mapping` at
the same time. If it is registered as a Sequence it only returns the
attribute names as string, not as `NamedAttribute`. It is technically
[62 lines not shown]
ValueTracking: Handle fdiv by known 0 case in computeKnownFPClass (#174855)
This will help subsume some transforms instsimplify performs
in the middle of SimplifyDemandedFPClass
[llvm][LoongArch] Add PC-relative address materialization using pcadd instructions
This patch adds support for PC-relative address materialization using
pcadd-class relocations, covering the HI20/LO12 pair and their GOT and
TLS variants (IE, LD, GD, and DESC).
Link: https://gcc.gnu.org/pipermail/gcc-patches/2025-December/703312.html
ValueTracking: Handle fdiv by known 0 case in computeKnownFPClass
This will help subsume some transforms instsimplify performs
in the middle of SimplifyDemandedFPClass
[VPlan] Allow truncation for lanes in VPScalarIVStepsRecipe (#175268)
VPScalarIVStepsRecipe relies on APInt truncation in order to vectorize
blocks with a width greater than the maximum value the types of some of
their (changing) operands are able to hold (e.g., an i1 input with a
vector width of 4). Simply reenable implicit truncation in
ConstantInt::get() to cover this case.
Remove the helper function given it is only called in one place to
prevent accidentally using it elsewhere where we probably do not want
implicit truncation turned on.
This fixes another case that we saw after
acb78bde6fb613a9af2a604bc69fa744a8cee850 did not fix that issue, which
had the same stack trace. We still want to keep lane constants as
unsigned.
Somewhat similar to 6d1e7d4982fabc9e245897056a5425496df6a7a3.
This test case comes from a tensorflow/XLA compilation from a test case
in https://github.com/google-research/spherical-cnn.