[mlir][affine] Update getSliceBounds to allow multi-result upper bound maps (#219369)
Resolve a long-standing TODO on supporting multi-result upper bound maps
on affine analysis utility getSliceBounds. This makes affine fusion more
powerful.
`getSliceBounds` threw away any upper bound that came out of more than
one inequality and put the constant bound in its place, under a TODO
saying it was conservative until `getConstDifference` in LoopFusion
could handle multiple bounds (b/126426796). Several inequalities is what
a destination loop clamped at the end of the data produces -- of a 1000
long dim tiled by 64, the region a tile reads is bounded by `min(%i * 64
+ 64, 1000)` -- and dropping that for the constant leaves `1000`, which
says only that the slice ends somewhere before the end of the data. A
slice of one 64-wide tile then costs as a slice of everything from the
tile onwards, and fusion refuses it as redundant computation that isn't
there.
Keep such a bound. It is already the min of its results, which is the
[12 lines not shown]
[ADT] Inline FoldingSetNodeID equality. NFC (#219856)
Every successful FoldingSet lookup pays the cost to call out-of-line
function, which calls memcmp. Just inline it.
[KnownFPClass] Refine known classes for `KnownFPClass::bitcast` (#215708)
`KnownFPClass::bitcast` should now be optimal (for ieee and bf16 types).
It is now able to correctly determine the `KnownFPClass` of any constant
value*. For non-constants, it is now able to rule out normal, and
subnormal results, in addition to ruling out specifically `qNaN`/`sNaN`
based off of the quiet bit.
I also added unit tests for `KnownFPClass::bitcast`.
AI Disclosure:
I used ChatGPT Codex (sol 5.6) to help generate the tests, which I
reviewed, built, and tested locally.
*Prior to this commit `KnownFPClass::bitcast` was unable to fully deduce
constants such as positive infinity:
```
/home/zerico/programming/llvm-project/llvm/unittests/Support/KnownFPClassTest.cpp:46: Failure
Expected equality of these values:
[6 lines not shown]
[KnownFPClass] Refine powi KnownFPClass deductions (#218581)
Adds deductions for when the `base` is known never negative-normal nor
negative-subnormal. Similar to the deductions added for `pow`
https://github.com/llvm/llvm-project/pull/215592.
AI Disclosure:
I used ChatGPT Codex (Sol-5.6) to help write tests, which I reviewed and
tested locally.