[InstCombine] Fold redundant FP clamp selects; relax min-max-pattern bailout in visitFCmp (#173452)
visitFCmp() previously bailed out when a following select matched a
clamp pattern. This blocks simplifications when the clamp is provably
redundant.
This PR allows simplification for clamp selects of flavor SPF_FMAXNUM/
SPF_FMINNUM when one arm is a constant and the other is a sitofp/uitofp
of an integer value, and the constant equals the exact min/max of that
integer domain:
* SPF_FMAXNUM (pattern max(X,C)): redundant if C is the minimum integer
mapped exactly to FP (e.g. X = sitofp i8, C = -128.0f).
* SPF_FMINNUM (pattern min(X,C)): redundant if C is the maximum integer
mapped exactly to FP (e.g. X = uitofp i8, C = 255.0f).
This fixes a regression in #173454
---------
Co-authored-by: Copilot <175728472+Copilot at users.noreply.github.com>
Co-authored-by: Yingwei Zheng <dtcxzyw at qq.com>
[Clang][Diagnostics] Mention 'import std' in typeid diagnostic (#173236)
Previously, the diagnostic only suggested including `<typeinfo>`. Since
C++20,the standard library may also be made available via `import std;`.
This change updates the diagnostic to mention `import std` as an
alternative and adds a test to cover the new wording.
[RISCV][SelectionDAG] Add a ISD::CTLS node for count leading redundant sign bits. Use it to select CLS(W). (#173417)
The RISC-V P extension adds an instruction equivalent to
__builtin_clrsb. AArch64 has a similar instruction that we currently fail to
select when using the builtin.
This patch adds a combine based on the canonical version of the pattern
emitted by clang for the builtin, (add (ctlz (xor x, (sra x, bw-1)))),
-1). I'm starting the combine at the ctlz because the outer add can
easily be combined into other nodes obscuring the full pattern. So we
generate (add (ctls x), 1) and hope the add will be combined away.
I've also added a combine for the pattern AArch64 recognizes
(ctlz_zero_undef (or (shl (xor x, (sra x, bw-1)), 1), 1)).
I've only enabled the combines when the target has a Legal or Custom
action for the operation, taking into account type promotion. We
can relax this in the future by adding a default expansion to
LegalizeDAG and adding more type legalization rules.
[RISCV] Update Andes45 vector load/stores scheduling info (#173806)
This PR adds latency/throughput for all RVV load/stores to the Andes45
series scheduling model.
[clang-tidy] Speed up deduplicating warnings from alias checks (#174237)
Right now, the deduplication algorithm runs in O(n²) time, because it
goes warning-by-warning (an O(n) operation), removing duplicates using
`std::vector::erase` (another O(n) operation). This starts taking up a
noticeable amount of time as you start getting a lot of warnings. For
example, running all checks over `clang/lib/Sema/Sema.cpp` and the
headers it includes:
```sh
time ./build/release/bin/clang-tidy -p build/debug --checks=* clang/lib/Sema/Sema.cpp -header-filter=.* > /dev/null
```
...takes 2m9s on my system before this change and 1m52s after. Now, this
scenario *is* a bit artificial; I imagine runs with so many warnings are
uncommon in practice. On the other hand, the change is quite small,
so we're not really going out of our way to improve it.
[lldb] Handle not being able to read a file in the SourceManager (#174346)
Even if a file has a valid modification time, it's possible that reading
the data fails. The SourceManager wasn't accounting for that, which
would result in a crash due to an unchecked read from a null `data_sp`.
We were seeing the issue when trying to read from a buggy virtual file
system, but presumably the same thing can happen with a poorly timed
unmount of a drive.
rdar://166414707
Merge branches 'users/chapuni/mcdc/nest/covmapdesc', 'users/chapuni/mcdc/nest/covgen', 'users/chapuni/mcdc/nest/logopstack' and 'users/chapuni/mcdc/nest/bitmapaddr' into HEAD
[clang][bytecode] Fix typeid test under msan (#174317)
The original problem description sounded sane but it was lacking a bit.
What happens where is that the global block is ultimately not
initialized simply because it was already created before and its
initializer failed, causing us to call invokeDtor() in a previous
evaluation.
Check for the initialion state earlier and abort there instead of
accessing the (now uninitialized) data of the block, causing msan
failures.
See the failed msan build at
https://lab.llvm.org/buildbot/#/builders/164/builds/17206
[flang][cuda] Skip sizeof intrinsic in check (#174339)
#174025 introduced a new semantic check for host intrinsic with device
variable.`sizeof` intrinsic extension should be skipped for this check.