Changes

Summary

  1. [AArch64] Add S/UQXTRN tablegen patterns. (details)
  2. [SimplifyCFG] simplifyUnreachable(): erase instructions iff they are guaranteed to transfer execution to unreachable (details)
  3. [flang][driver] Add support for `--version` in the bash wrapper (details)
  4. [IRBuilder] Avoid fetching pointer element type in some assertions (details)
  5. [SelectionDAG] Use KnownBits::insertBits instead of separate APInt::insertBits calls. NFC. (details)
  6. [SelectionDAG] Replace APInt.lshr().trunc() with APInt.extractBits() where possible. NFC. (details)
  7. [X86][SSE] Add mulhu/mulhs constant folding tests (details)
  8. [KnownBits] Merge const/non-const KnownBits::extractBits implementations. NFC. (details)
  9. [analyzer] Fix calculating offset for fields with an empty type (details)
  10. [clangd][iwyu] explicitly includes `<atomic>` (details)
  11. [llvm][iwyu] explicitly includes <functional> and <utility> (details)
Commit fbc329efbdba3edad78a1651148b340bcc7bf032 by david.green
[AArch64] Add S/UQXTRN tablegen patterns.

This adds simple patterns for signed and unsigned saturating extract
narrow instructions. They combine a min/max/truncate into a single
instruction, providing that the immediates on the min/max are correct
for the saturation type. This is just handled in tablegen with some
extra patterns.

v2i64->v2i32 is not handled here as the min/max nodes are not legal,
making the lowering quite different.

Differential Revision: https://reviews.llvm.org/D103263
The file was modifiedllvm/test/CodeGen/AArch64/qmovn.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrInfo.td
Commit fc150cecd7484e47328fc78d4a3d597e2791b0fe by lebedev.ri
[SimplifyCFG] simplifyUnreachable(): erase instructions iff they are guaranteed to transfer execution to unreachable

This replaces the current ad-hoc implementation,
by syncing the code from InstCombine's implementation in `InstCombinerImpl::visitUnreachableInst()`,
with one exception that here in SimplifyCFG we are allowed to remove EH instructions.

Effectively, this now allows SimplifyCFG to remove calls (iff they won't throw and will return),
arithmetic/logic operations, etc.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D105374
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/lib/Analysis/ValueTracking.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstructionCombining.cpp
The file was modifiedllvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/simplifyUnreachable-degenerate-conditional-branch-with-matching-destinations.ll
Commit 45e5214b4354d4f9150fcc1ea1997280f709b3dc by andrzej.warzynski
[flang][driver] Add support for `--version` in the bash wrapper

The bash wrapper script, `flang`, calls `flang-new -fc1` under the hood,
which does not support `--version` (this is consistent with `clang -cc1
--version`). This change is needed for `flang --version` to work as
expected.

Note that `flang --version` (the Flang bash wrapper script for the
compiler driver) gives rather minimal output compared to `flang-new
--version` (the Flang compiler driver). As the wrapper script is just a
temporary solution for us, this should be sufficient.

Differential Revision: https://reviews.llvm.org/D105352
The file was modifiedflang/tools/f18/flang.in
Commit e91440628e77bbde7065a40231b776e47f19beb8 by nikita.ppv
[IRBuilder] Avoid fetching pointer element type in some assertions

Specifically the CreateMaskedStore and CreateMaskedScatter APIs.
The CreateMaskedLoad and CreateMaskedGather APIs will need an
additional type argument.
The file was modifiedllvm/lib/IR/IRBuilder.cpp
Commit e2e44c3da93c0c8b6e1322dcfbcd9fb18ac702eb by llvm-dev
[SelectionDAG] Use KnownBits::insertBits instead of separate APInt::insertBits calls. NFC.
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit 80dd591610cbdd9f5898f138a4b8df7543ef44ff by llvm-dev
[SelectionDAG] Replace APInt.lshr().trunc() with APInt.extractBits() where possible. NFC.

This also allows us to use KnownBits::extractBits in one case.
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit cc38f8939da4aec85e7d0ef4de412e30d4de5a14 by llvm-dev
[X86][SSE] Add mulhu/mulhs constant folding tests

These should be folded by D103323
The file was modifiedllvm/test/CodeGen/X86/pmulh.ll
Commit 89c1c64cc3170a05a881bb9954feafc3edca6704 by llvm-dev
[KnownBits] Merge const/non-const KnownBits::extractBits implementations. NFC.

These are identical and can be just const.
The file was modifiedllvm/include/llvm/Support/KnownBits.h
Commit c558b1fca7350f4f4d8e7387fb2ead951284a5cf by jubnzv
[analyzer] Fix calculating offset for fields with an empty type

Fix offset calculation routines in padding checker to avoid assertion
errors described in bugzilla issue 50426. The fields that are subojbects
of zero size, marked with [[no_unique_address]] or empty bitfields will
be excluded from padding calculation routines.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D104097
The file was modifiedclang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
The file was addedclang/test/Analysis/padding_no_unique_address.cpp
Commit 478092d33116ec01ad0b82f7eeedb1e1f07aef93 by cjdb
[clangd][iwyu] explicitly includes `<atomic>`

Compiling clangd with Clang modules and libc++ revealed that
`support/Threading.h` uses `std::atomic` but wasn't including the
correct header.

Differential Revision: https://reviews.llvm.org/D105400
The file was modifiedclang-tools-extra/clangd/support/Threading.h
Commit 95923c0ba245377205f783607aaacbf8c667b353 by cjdb
[llvm][iwyu] explicitly includes <functional> and <utility>

Compiling LLVM with Clang modules and libc++ identified that
`Support/Printable.h` and `ADL/SmallVector.h` were using features that
live in these headers.

Differential Revision: https://reviews.llvm.org/D105402
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
The file was modifiedllvm/include/llvm/Support/Printable.h