platform/upstream/llvm.git
2 years ago[RISCV] Remove RISCVISD::BREV8 and use RISCVISD::GREV instead.
Craig Topper [Sun, 30 Jan 2022 06:19:15 +0000 (22:19 -0800)]
[RISCV] Remove RISCVISD::BREV8 and use RISCVISD::GREV instead.

We already have an ISD opcode for the more general GREV/GREVI
instructon. We can just use it with the encoding that corresponds
to the behavior of brev8. This is similar to what we do for orc.b
where we use the GORC ISD opcode.

2 years ago[RISCV] Rerrange RISCVInstrInfoZB.td to better group related wthings. NFC
Craig Topper [Sun, 30 Jan 2022 05:15:11 +0000 (21:15 -0800)]
[RISCV] Rerrange RISCVInstrInfoZB.td to better group related wthings. NFC

Especially placing W instructions/patterns near their non-W versions.

2 years ago[ELF] De-template getAndFeatures. NFC
Fangrui Song [Sun, 30 Jan 2022 04:11:59 +0000 (20:11 -0800)]
[ELF] De-template getAndFeatures. NFC

2 years ago[clang-tidy] Organize the release notes a little better
Richard [Sat, 29 Jan 2022 01:14:33 +0000 (18:14 -0700)]
[clang-tidy] Organize the release notes a little better

- Sort new checks by check name
- Sort changes to existing checks by check name
- Add docs for changes to readability-simplify-boolean-expr
- Move check changes from "Improvements to clang-tidy" to
  "Changes in existing checks" section

Differential Revision: https://reviews.llvm.org/D118519

2 years ago[ELF] Make errorOrWarn opaque to decrease code size. NFC
Fangrui Song [Sun, 30 Jan 2022 03:31:09 +0000 (19:31 -0800)]
[ELF] Make errorOrWarn opaque to decrease code size. NFC

In my x86-64 lld, .text is -3.08Ki smaller.

2 years ago[RISCV] Use RVBUnary to simplify ZEXT_H_RV32/ZEXT_H_RV64 definitions. NFC
Craig Topper [Sun, 30 Jan 2022 02:26:20 +0000 (18:26 -0800)]
[RISCV] Use RVBUnary to simplify ZEXT_H_RV32/ZEXT_H_RV64 definitions. NFC

2 years ago[clang][AVR] Set '-fno-use-cxa-atexit' to default
Ben Shi [Fri, 28 Jan 2022 10:09:12 +0000 (10:09 +0000)]
[clang][AVR] Set '-fno-use-cxa-atexit' to default

AVR is baremetal environment, so the avr-libc does not support
'__cxa_atexit()'.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D118445

2 years ago[Clang] Move XCore specific options from Clang.cpp to XCore.cpp
Ben Shi [Sat, 29 Jan 2022 12:42:06 +0000 (12:42 +0000)]
[Clang] Move XCore specific options from Clang.cpp to XCore.cpp

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D118535

2 years ago[ELF] Optimize obj.getSectionIndex. NFC
Fangrui Song [Sun, 30 Jan 2022 02:01:58 +0000 (18:01 -0800)]
[ELF] Optimize obj.getSectionIndex. NFC

2 years ago[ELF] Simplify eSyms. NFC
Fangrui Song [Sun, 30 Jan 2022 01:00:38 +0000 (17:00 -0800)]
[ELF] Simplify eSyms. NFC

2 years ago[ELF] createInputSection: remove unneeded argument. NFC
Fangrui Song [Sun, 30 Jan 2022 00:52:32 +0000 (16:52 -0800)]
[ELF] createInputSection: remove unneeded argument. NFC

2 years ago[ELF] Avoid repeated getObj construction in getSectionIndex. NFC
Fangrui Song [Sun, 30 Jan 2022 00:51:00 +0000 (16:51 -0800)]
[ELF] Avoid repeated getObj construction in getSectionIndex. NFC

2 years ago[ELF] Reorder InputSectionBase::parent. NFC
Fangrui Song [Sun, 30 Jan 2022 00:20:40 +0000 (16:20 -0800)]
[ELF] Reorder InputSectionBase::parent. NFC

Move it before others.

2 years ago[ELF] Reorder InputFile members. NFC
Fangrui Song [Sun, 30 Jan 2022 00:10:52 +0000 (16:10 -0800)]
[ELF] Reorder InputFile members. NFC

`symbols` is used frequently. Moving it before others can decrease offsets.

2 years ago[openmp][cmake] `CMAKE_INSTALL_BINDIR` usage should not be quoted
John Ericson [Fri, 28 Jan 2022 18:21:21 +0000 (18:21 +0000)]
[openmp][cmake] `CMAKE_INSTALL_BINDIR` usage should not be quoted

As @mstorsjo wrote in https://reviews.llvm.org/D117945#inline-1132920 :

> This change seems to have broken one aspect: When doing `ninja
install` I now get a warning saying `Error copying file "libomp.dll" to
"libiomp5md.dll".`, and `libiomp5md.dll` isn't installed.
>
> I believe the reason is that the inline cmake snippet is written to
`runtime/src/cmake_install.cmake` and then executed on install, but on
install, `${CMAKE_INSTALL_BINDIR}` isn't set (as `GNUInstallDirs` isn't
included there). Should this maybe expand `${CMAKE_INSTALL_BINDIR}`
right here instead of deferring it to the install cmake, or what's the
right course of action?

I agree that is the right course of action. We also agreed to restore the `CMAKE_INSTALL_PREFIX` that was there before, too.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D118528

2 years agoRemove reference to LLVMLibC as the doc has moved.
Jeff Bailey [Sat, 29 Jan 2022 15:54:23 +0000 (15:54 +0000)]
Remove reference to LLVMLibC as the doc has moved.

https://reviews.llvm.org/D117436 caused a build failure
due to this error.

Tested:
ninja docs-llvm-libc builds

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D118537

2 years ago[ELF] --gdb-index: switch to SmallVector. NFC
Fangrui Song [Sat, 29 Jan 2022 23:24:56 +0000 (15:24 -0800)]
[ELF] --gdb-index: switch to SmallVector. NFC

2 years ago[libc++][test] Clean up libcxx/test/support/MoveOnly.h
Joe Loser [Fri, 28 Jan 2022 19:38:10 +0000 (14:38 -0500)]
[libc++][test] Clean up libcxx/test/support/MoveOnly.h

Remove copy and copy assignment rather than have them as private declarations.
They are superfluous given the move and move assignment.

As a drive-by, also specialize `std::hash` without reopening `namespace std`.

Differential Revision: https://reviews.llvm.org/D118502

2 years ago[ELF] Refactor -z combreloc
Fangrui Song [Sat, 29 Jan 2022 22:45:58 +0000 (14:45 -0800)]
[ELF] Refactor -z combreloc

* `RelocationBaseSection::addReloc` increases `numRelativeRelocs`, which
  duplicates the work done by RelocationSection<ELFT>::writeTo.
* --pack-dyn-relocs=android has inappropropriate DT_RELACOUNT.
  AndroidPackedRelocationSection does not necessarily place relative relocations
  in the front and DT_RELACOUNT might cause semantics error (though our
  implementation doesn't and Android bionic doesn't use DT_RELACOUNT anyway.)

Move `llvm::partition` to a new function `partitionRels` and compute
`numRelativeRelocs` there. Now `RelocationBaseSection::addReloc` is trivial and
can be moved to the header to enable inlining.

The rest of DynamicReloc and `-z combreloc` handling is moved to the
non-template `RelocationBaseSection::computeRels` to decrease code size. My
x86-64 lld executable is 44+KiB smaller.

While here, rename `sort` to `combreloc`.

2 years ago[LLD][MinGW] Add --heap argument support
Mateusz Mikuła [Sat, 29 Jan 2022 21:36:50 +0000 (23:36 +0200)]
[LLD][MinGW] Add --heap argument support

Noticed in https://github.com/msys2/MINGW-packages/pull/10567.

Differential Revision: https://reviews.llvm.org/D118405

2 years ago[sanitizer_common] Use atomic builtin in sanitizer_atomic_clang.h
Rainer Orth [Sat, 29 Jan 2022 21:52:55 +0000 (22:52 +0100)]
[sanitizer_common] Use atomic builtin in sanitizer_atomic_clang.h

As discussed in D118021 <https://reviews.llvm.org/D118021>, `clang -m32` on
Solaris/sparcv9 currently incorrectly doesn't inline atomics on 8-byte
operands, unlike `gcc`.  With the workaround in that patch in place, we're
left with may undefined references to `__sync_val_compare_and_swap_8`,
which isn't provided by `libatomic`.  This reference is due to the use of
`__sync_val_compare_and_swap` in `sanitizer_atomic_clang.h`'s
`atomic_compare_exchange_strong`.  As is already done in
`scudo/standalone/atomic_helpers.h`, using `__atomic_compare_exchange`
instead avoids this problem.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D118024

2 years ago[NewGVN] do phi(undef, x) -> x only if x is not poison
Nuno Lopes [Wed, 26 Jan 2022 10:34:20 +0000 (10:34 +0000)]
[NewGVN] do phi(undef, x) -> x only if x is not poison

phi([undef, A], [x, B]) -> x is only correct x is guaranteed to be
a non-poison value.
Otherwise we would be changing an undef to poison in the branch A.

Differential Revision: https://reviews.llvm.org/D117907

2 years ago[gn build] (manually) port 36892727e4f1
Nico Weber [Sat, 29 Jan 2022 21:06:24 +0000 (16:06 -0500)]
[gn build] (manually) port 36892727e4f1

2 years agoenable plugins for clang-tidy
Jameson Nash [Mon, 4 Oct 2021 22:37:57 +0000 (18:37 -0400)]
enable plugins for clang-tidy

Fixes #32739

Differential Revision: https://reviews.llvm.org/D111100

2 years ago[SmallVector] Optimize move assignment operator for N==0 case
Fangrui Song [Sat, 29 Jan 2022 19:03:42 +0000 (11:03 -0800)]
[SmallVector] Optimize move assignment operator for N==0 case

Due to the SmallVector hierarchy, N==0 cannot be leveraged by functions defined
in base classes. This patch special cases N==0 for SmallVector to save code size
and be slightly more efficient.

In a Release build of x86 only clang, .text is -3.34KiB smaller. In lld .text is
7.17KiB smaller.

Reviewed By: lichray

Differential Revision: https://reviews.llvm.org/D117976

2 years ago[InstCombine] add tests for demanded bit of mul; NFC
Sanjay Patel [Fri, 28 Jan 2022 22:10:39 +0000 (17:10 -0500)]
[InstCombine] add tests for demanded bit of mul; NFC

2 years ago[MLGO] Regalloc: allow multiple occurences of -regalloc-enable-advisor
Mircea Trofin [Sat, 29 Jan 2022 16:59:31 +0000 (08:59 -0800)]
[MLGO] Regalloc: allow multiple occurences of -regalloc-enable-advisor

This allows scearios where some central config sets it one way and a
user wants to override it.

2 years ago[clang][dataflow] Merge distinct pointer values in Environment::join
Stanislav Gatev [Fri, 28 Jan 2022 16:23:01 +0000 (16:23 +0000)]
[clang][dataflow] Merge distinct pointer values in Environment::join

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D118480

2 years ago[OpenMP] Fix link error on Windows caused by `interop` functions
Shilei Tian [Sat, 29 Jan 2022 16:29:19 +0000 (11:29 -0500)]
[OpenMP] Fix link error on Windows caused by `interop` functions

This patch fixes the link error on Windows caused by `interop`
functions.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D118524

2 years ago[VPlan] Handle IV vector splat using VPWidenCanonicalIV.
Florian Hahn [Sat, 29 Jan 2022 16:22:18 +0000 (16:22 +0000)]
[VPlan] Handle IV vector splat using VPWidenCanonicalIV.

This patch tries to use an existing VPWidenCanonicalIVRecipe
instead of creating another step-vector for canonical
induction recipes in widenIntOrFpInduction.

This has the following benefits:

 1. First step to avoid setting both vector and scalar values for the
    same induction def.
 2. Reducing complexity of widenIntOrFpInduction through making things
    more explicit in VPlan
 3. Only need to splat the vector IV for block in masks.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D116123

2 years ago[X86] LowerFunnelShift - enable v8i16 lowering
Simon Pilgrim [Sat, 29 Jan 2022 16:20:36 +0000 (16:20 +0000)]
[X86] LowerFunnelShift - enable v8i16 lowering

2 years ago[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.
Simon Pilgrim [Tue, 25 Jan 2022 22:52:09 +0000 (22:52 +0000)]
[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.

2 years ago[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.
Arthur O'Dwyer [Sat, 29 Jan 2022 16:02:23 +0000 (11:02 -0500)]
[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.

Make these look the same as everywhere else.

2 years ago[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim [Sat, 29 Jan 2022 16:08:06 +0000 (16:08 +0000)]
[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid deref...
Simon Pilgrim [Sat, 29 Jan 2022 15:34:26 +0000 (15:34 +0000)]
[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()
Arthur O'Dwyer [Sat, 29 Jan 2022 00:50:48 +0000 (19:50 -0500)]
[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()

Differential Revision: https://reviews.llvm.org/D118518

2 years ago[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq...
Simon Pilgrim [Sat, 29 Jan 2022 15:16:47 +0000 (15:16 +0000)]
[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq()) reductions

This greatly simplifies the codegen for recognising PTEST patterns and matches the codegen from the very similar LowerVectorAllZero

2 years ago[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.
Arthur O'Dwyer [Sat, 29 Jan 2022 15:14:02 +0000 (10:14 -0500)]
[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.

Should fix the Apple build CI, e.g.
https://buildkite.com/llvm-project/libcxx-ci/builds/8227

2 years agoSpeculatively fix the sphinx build for Clang's attribute reference
Aaron Ballman [Sat, 29 Jan 2022 14:38:57 +0000 (09:38 -0500)]
Speculatively fix the sphinx build for Clang's attribute reference

2 years ago[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling
Simon Pilgrim [Sat, 29 Jan 2022 14:26:41 +0000 (14:26 +0000)]
[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling

Lets us see through multiple use operands

2 years ago[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering...
Simon Pilgrim [Sat, 29 Jan 2022 13:58:25 +0000 (13:58 +0000)]
[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering pre-AVX512

Without AVX512 (which can efficiently extend/truncate to vXi16/vXi32), unpacking/packing to vXi16 is more efficient that relying on the (uops-heavy) PBLENDV shift expansion

2 years agoRevert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes applied
Aaron Ballman [Sat, 29 Jan 2022 13:11:14 +0000 (08:11 -0500)]
Revert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes applied

fad7e491a0770ac4336934030ac67d77e7af5520 was a revert of
86797fdb6f51d32f285e48b6d3e0fc5b8b852734 due to build failures. This
hopefully fixes them.

2 years ago[M68k] Add addressing modes ARIPI and ARIPD support for BTST
Jim Lin [Fri, 28 Jan 2022 05:26:15 +0000 (13:26 +0800)]
[M68k] Add addressing modes ARIPI and ARIPD support for BTST

BTST missed ARIPI and ARIPD addressing modes support.

Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D116580

2 years ago[SVE] Remove AArch64ISD::PFALSE.
Paul Walker [Fri, 28 Jan 2022 14:40:50 +0000 (14:40 +0000)]
[SVE] Remove AArch64ISD::PFALSE.

AArch64ISD::PFALSE does not provide any value, in fact it can
prevent common combines from firing.  We only needed to lower
to PFALSE until ISD::SPLAT_VECTOR became generally available.

Differential Revision: https://reviews.llvm.org/D118469

2 years ago[AArch64] Add isel for bitcasting between bfloat and half types.
Paul Walker [Fri, 28 Jan 2022 00:29:09 +0000 (00:29 +0000)]
[AArch64] Add isel for bitcasting between bfloat and half types.

Differential Revision: https://reviews.llvm.org/D118420

2 years agoRaise the minimum Visual Studio version to VS2019
Simon Pilgrim [Sat, 29 Jan 2022 10:56:41 +0000 (10:56 +0000)]
Raise the minimum Visual Studio version to VS2019

As raised here: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153881.html

Now that VS2022 is on general release, LLVM is expected to build on VS2017, VS2019 and VS2022, which is proving hazardous to maintain due to changes in behaviour including preprocessor and constexpr changes. Plus of the few developers that work with VS, many have already moved to VS2019/22.

This patch proposes to raise the minimum supported version to VS2019 (16.x) - I've made the hard limit 16.0 or later, with the soft limit VS2019 16.7 - older versions of VS2019 are "allowed" (at your own risk) via the LLVM_FORCE_USE_OLD_TOOLCHAIN cmake flag.

Differential Revision: https://reviews.llvm.org/D114639

2 years ago[IR] Require matching signature in getCalledFunction()
Nikita Popov [Fri, 9 Jul 2021 20:56:53 +0000 (22:56 +0200)]
[IR] Require matching signature in getCalledFunction()

With opaque pointers, it's possible to directly call a function with
a different signature, without an intermediate bitcast. However,
lot's of code using getCalledFunction() reasonably assumes that the
signatures match (which is always true without opaque pointers).
Add an explicit check to that effect.

The test case is from D105313, where I ran into the problem, but on
further investigation this also affects lots of other code, we just
have little coverage with mismatching signatures. The change from
D105313 is still desirable for other reasons, but this patch
addresses the root problem when it comes to opaque pointers.

Differential Revision: https://reviews.llvm.org/D105733

2 years ago[RISCV] Correct predicate orc.b pattern to not include Zbkb.
Craig Topper [Sat, 29 Jan 2022 08:09:03 +0000 (00:09 -0800)]
[RISCV] Correct predicate orc.b pattern to not include Zbkb.

This was incorrectly lumped in when the predicate was changed for
the rotate instructions.

2 years ago[WebAssembly][NFC] Refactor WasmSymbol type setting code
Paulo Matos [Fri, 28 Jan 2022 11:02:30 +0000 (12:02 +0100)]
[WebAssembly][NFC] Refactor WasmSymbol type setting code

This refactors some code dealing with setting Wasm symbol types.
Some of the code dealing with types was moved from
`WebAssemblyUtilities` to  `WebAssemblyTypeUtilities`.

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D118121

2 years ago[RISCV] Custom legalize BITREVERSE with Zbkb.
Craig Topper [Sat, 29 Jan 2022 06:55:37 +0000 (22:55 -0800)]
[RISCV] Custom legalize BITREVERSE with Zbkb.

With Zbkb, a bitreverse can be split into a rev8 and a brev8.

Reviewed By: VincentWu

Differential Revision: https://reviews.llvm.org/D118430

2 years ago[NFC] Add missing doxygen file tag in llvm/include/llvm/ADT/ headers
Shivam Gupta [Fri, 28 Jan 2022 15:12:54 +0000 (20:42 +0530)]
[NFC] Add missing doxygen file tag in llvm/include/llvm/ADT/ headers

Few header file don't have file tag in them. This patch can be help
in viewing doxygen documentation. When we hover on the included header
file, small description will display.

Reviewed By: aaron.ballman, xgupta

Differential Revision: https://reviews.llvm.org/D116004

2 years ago[TableGen] Detect multiple Processors with the same name.
Craig Topper [Sat, 29 Jan 2022 06:37:00 +0000 (22:37 -0800)]
[TableGen] Detect multiple Processors with the same name.

Due to a bad merge we ended up with duplicate entries in our
downstream repo. I was surprised that nothing caught it. I wrote
this check so I could fix our downstream repo and figured I might
as well share it.

Reviewed By: RKSimon, spatel

Differential Revision: https://reviews.llvm.org/D118497

2 years ago[libc++][ranges][NFC] Small cleanup to the Ranges status page.
Konstantin Varlamov [Sat, 29 Jan 2022 06:39:12 +0000 (22:39 -0800)]
[libc++][ranges][NFC] Small cleanup to the Ranges status page.

- add a few missing links to code reviews;
- reorder the views to follow the same order as in the Standard.

2 years ago[ELF][test] Improve INSERT [AFTER|BEFORE] and adjustSectionsBeforeSorting tests
Fangrui Song [Sat, 29 Jan 2022 06:21:12 +0000 (22:21 -0800)]
[ELF][test] Improve INSERT [AFTER|BEFORE] and adjustSectionsBeforeSorting tests

2 years ago[cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime...
John Ericson [Sat, 22 Jan 2022 00:21:19 +0000 (19:21 -0500)]
[cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm

We previously had a few varied definitions of this floating around.

I had tried to make the one installed with LLVM handle all the cases, and then made the others use it, but this ran into issues with `HandleOutOfTreeLLVM` not working for compiler-rt, and also `CMAKE_EXE_LINKER_FLAGS` not working right without `CMP0056` set to the new behavior.

 My compromise solution is this:

 - No not completely deduplicate: the runtime libs will instead use a version that still exists as part of the internal and not installed common shared CMake utilities. This avoids `HandleOutOfTreeLLVM` or a workaround for compiler-rt.

- Continue to use `CMAKE_REQUIRED_FLAGS`, which effects compilation and linking. Maybe this is unnecessary, but it's safer to leave that as a future change. Also means we can avoid `CMP0056` for now, to try out later, which is good incrementality too.

- Call it `llvm_check_compiler_linker_flag` since it, in fact is about both per its implementation (before and after this patch), so there is no name collision.

In the future, we might still enable CMP0056 and make compiler-rt work with HandleOutOfTreeLLVM, which case we delete `llvm_check_compiler_flag` and go back to the old way (as these are, in fact, linking related flags), but that I leave for someone else as future work.

The original issue was reported to me in https://reviews.llvm.org/D116521#3248117 as
D116521 made clang and LLVM use the common cmake utils.

Reviewed By: sebastian-ne, phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D117537

2 years ago[OpenMP] Fix wrong number in openmp/runtime/src/dllexports
Shilei Tian [Sat, 29 Jan 2022 05:22:57 +0000 (00:22 -0500)]
[OpenMP] Fix wrong number in openmp/runtime/src/dllexports

This patch fixes the issue that numbers assigned to `interop` functions were already taken in `openmp/runtime/src/dllexports`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D118523

2 years ago[ELF] Change the search order for dependent libraries
Petr Hosek [Fri, 28 Jan 2022 09:50:49 +0000 (01:50 -0800)]
[ELF] Change the search order for dependent libraries

When processing dependent libraries, if there's a directory of the same
name as the library being searched for, either in the current directory
or earlier in the search order, LLD will try to open it and report an
error. This is because LLD uses file existence check. To address this
issue we reverse the order, searching the library by basename first
and only considering search paths later, and current directory last.

Differential Revision: https://reviews.llvm.org/D118498

2 years agoRecommit "[InstCombine] Fold and-reduce idiom"
Max Kazantsev [Sat, 29 Jan 2022 04:01:35 +0000 (11:01 +0700)]
Recommit "[InstCombine] Fold and-reduce idiom"

Checks of original vector types made more thorough.

Differential Revision: https://reviews.llvm.org/D118317

2 years ago[libc++][ranges][NFC] Update and slightly cleanup Ranges status page.
Konstantin Varlamov [Sat, 29 Jan 2022 04:13:53 +0000 (20:13 -0800)]
[libc++][ranges][NFC] Update and slightly cleanup Ranges status page.

- add missing links to sections of the Standard and to patches;
- update the status on a couple of items.

2 years agoDelete dead code
Sanjoy Das [Fri, 28 Jan 2022 19:04:31 +0000 (11:04 -0800)]
Delete dead code

Differential Revision: https://reviews.llvm.org/D118501

2 years ago[X86][avx512fp16] Promote fp16 to fp32 for frem.
Luo, Yuanke [Fri, 28 Jan 2022 14:54:17 +0000 (22:54 +0800)]
[X86][avx512fp16] Promote fp16 to fp32 for frem.

Promote fp16 to fp32 for frem.

Differential Revision: https://reviews.llvm.org/D118470

2 years ago[gn build] (manually) port 99217fa8a02
Nico Weber [Sat, 29 Jan 2022 03:33:19 +0000 (22:33 -0500)]
[gn build] (manually) port 99217fa8a02

2 years ago[OpenMP] disable build of old nvptx device runtime
Ye Luo [Sat, 29 Jan 2022 03:24:29 +0000 (21:24 -0600)]
[OpenMP] disable build of old nvptx device runtime

Fully respect LIBOMPTARGET_BUILD_NVPTX_BCLIB. There is no CUDA toolchain dependency. Complement D118268.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D118522

2 years ago[Test] Add pointer comparison test that crashed with D118317
Max Kazantsev [Sat, 29 Jan 2022 03:12:28 +0000 (10:12 +0700)]
[Test] Add pointer comparison test that crashed with D118317

2 years ago[RISCV] Improve extract_vector_elt for fixed mask registers.
jacquesguan [Sat, 15 Jan 2022 09:14:38 +0000 (17:14 +0800)]
[RISCV] Improve extract_vector_elt for fixed mask registers.

Now the backend promotes mask vector to an i8 vector and extract element from that. We could bitcast to a widen element vector, and extract from it to GPR, then use I instruction to extract the certain bit.

Differential Revision: https://reviews.llvm.org/D117389

2 years ago[Test] Recommit tests that were reverted by mistake along with other patch
Max Kazantsev [Sat, 29 Jan 2022 02:53:36 +0000 (09:53 +0700)]
[Test] Recommit tests that were reverted by mistake along with other patch

2 years ago[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.
Sheng [Sat, 29 Jan 2022 01:59:58 +0000 (09:59 +0800)]
[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.

This patch legalizes more instructions and data types.

Differential Revision: https://reviews.llvm.org/D117264

2 years agoAdd 'clangd' prefix to remote index proto targets
Sam McCall [Sat, 29 Jan 2022 01:19:43 +0000 (02:19 +0100)]
Add 'clangd' prefix to remote index proto targets

Some pieces of build infrastructure (shlib, debian package) classify
targets based on whether they begin with "clang".

2 years agoRevert "[UpdateTestChecks] Add --filter and --filter-out options"
David Greene [Sat, 29 Jan 2022 01:06:51 +0000 (17:06 -0800)]
Revert "[UpdateTestChecks] Add --filter and --filter-out options"

Broke some update-test-checks tests.  Reverting while developing a fix.

This reverts commit 030f71698d52f228929da5e3148602f4a3daff7d.

2 years agoMove LLVM Proposal to doc directory, create index
Jeff Bailey [Sat, 29 Jan 2022 00:27:34 +0000 (00:27 +0000)]
Move LLVM Proposal to doc directory, create index

The LLVM Libc project is no longer just a proposal and should have
a webpage tracking the status of the project.  This changes
puts the pieces into the right place so that the webpage can be
created.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D117436

2 years ago[flang] Implement a runtime routine to report fatal errors with source position
Peter Steinfeld [Fri, 28 Jan 2022 21:21:29 +0000 (13:21 -0800)]
[flang] Implement a runtime routine to report fatal errors with source position

The title says it all.

I implemented a routine called "Crash" and added a test.

Differential Revision: https://reviews.llvm.org/D118509

2 years ago[OpenMP] Accept shortened triples for -Xopenmp-target=
Joseph Huber [Fri, 28 Jan 2022 18:28:28 +0000 (13:28 -0500)]
[OpenMP] Accept shortened triples for -Xopenmp-target=

This patch builds on the change in D117634 that expanded the short
triples when passed in by the user. This patch adds the same
functionality for the `-Xopenmp-target=` flag. Previously it was
unintuitive that passing `-fopenmp-targets=nvptx64
-Xopenmp-target=nvptx64 <arg>` would not forward the arg because the
triples did not match on account of `nvptx64` being expanded to
`nvptx64-nvidia-cuda`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D118495

2 years agoRevert "Add BITINT_MAXWIDTH support"
Jan Korous [Fri, 28 Jan 2022 23:08:45 +0000 (15:08 -0800)]
Revert "Add BITINT_MAXWIDTH support"

This reverts commit 86797fdb6f51d32f285e48b6d3e0fc5b8b852734.

Differential Revision: https://reviews.llvm.org/D117238

2 years ago[mlir][sparse] Adding standard pipeline for tests.
wren romano [Thu, 27 Jan 2022 00:44:32 +0000 (16:44 -0800)]
[mlir][sparse] Adding standard pipeline for tests.

Addresses https://bugs.llvm.org/show_bug.cgi?id=52409 aka https://github.com/llvm/llvm-project/issues/51751

Reviewed By: aartbik, mehdi_amini

Differential Revision: https://reviews.llvm.org/D117919

2 years ago[clang-tidy] Recognize labelled statements when simplifying boolean exprs
Richard [Thu, 30 Dec 2021 22:41:27 +0000 (15:41 -0700)]
[clang-tidy] Recognize labelled statements when simplifying boolean exprs

Inside a switch the caseStmt() and defaultStmt() have a nested statement
associated with them.  Similarly, labelStmt() has a nested statement.
These statements were being missed when looking for a compound-if of the
form "if (x) return true; return false;" when the if is nested under one
of these labelling constructs.

Enhance the matchers to look for these nested statements using some
private matcher hasSubstatement() traversal matcher on case, default
and label statements.  Add the private matcher hasSubstatementSequence()
to match the compound "if (x) return true; return false;" pattern.

- Add unit tests for private matchers and corresponding test
  infrastructure
- Add corresponding test file readability-simplify-bool-expr-case.cpp.
- Fix variable name copy/paste error in readability-simplify-bool-expr.cpp.
- Drop the asserts, which were used only for debugging matchers.
- Run clang-format on the whole check.
- Move local functions out of anonymous namespace and declare state, per
  LLVM style guide
- Declare labels constexpr
- Declare visitor arguments as pointer to const
- Drop braces around simple control statements per LLVM style guide
- Prefer explicit arguments over default arguments to methods

Differential Revision: https://reviews.llvm.org/D56303

Fixes #27078

2 years ago[Driver] Remove -fno-experimental-new-pass-manager
Fangrui Song [Fri, 28 Jan 2022 22:58:26 +0000 (14:58 -0800)]
[Driver] Remove -fno-experimental-new-pass-manager

to give users a final warning that they need to migrate away. They could still
use -flegacy-pass-manager for Clang 14.0.0, but the functionality may not work
for 15.0.0.

-fexperimental-new-pass-manager is a no-op for default builds, so not urgent to
be removed for 14.0.0.

clang/test/Frontend/optimization-remark-with-hotness.c is removed because its
new PM replacement optimization-remark-with-hotness-new-pm.c exists.

Reviewed By: aeubanks, nikic

Differential Revision: https://reviews.llvm.org/D118313

2 years ago[MLIR][GPU] Add missing #include to SerializeToHsaco.cpp
Krzysztof Drewniak [Fri, 28 Jan 2022 21:05:02 +0000 (21:05 +0000)]
[MLIR][GPU] Add missing #include to SerializeToHsaco.cpp

llvm/Support/Path.h was likely previously implicitly included, and a
refactoring removed that inclusion, breaking the pass.

Differential Revision: https://reviews.llvm.org/D118508

2 years ago[MLIR] Factor out common parts of the TLike constraint
Krzysztof Drewniak [Thu, 27 Jan 2022 16:48:44 +0000 (16:48 +0000)]
[MLIR] Factor out common parts of the TLike constraint

Type constraints such as BoolLike and SignlessIntegerLike appear to
have been defined by copy-paste and all share an underlying TypesLike
structure that can be factored out.

This also allows for defining additional constraints of a similar
form, such as F32Like.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D118382

2 years agoUpdate module map for 4ce1f3d47c33daccfb7f4e906c3f57b404900036
Adrian Prantl [Fri, 28 Jan 2022 22:51:46 +0000 (14:51 -0800)]
Update module map for 4ce1f3d47c33daccfb7f4e906c3f57b404900036

2 years ago[Driver] Add CUDA support for --offload param
Daniele Castagna [Fri, 28 Jan 2022 22:49:48 +0000 (14:49 -0800)]
[Driver] Add CUDA support for --offload param

The --offload option was added in D110622 to "override the default
device target". When it landed it supported only HIP.  This patch
extends that option to support SPIR-V targets for CUDA.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D117137

2 years ago[ScalarEvolution] Handle <= and >= in non infinite loops
William S. Moses [Tue, 25 Jan 2022 01:02:53 +0000 (20:02 -0500)]
[ScalarEvolution] Handle <= and >= in non infinite loops

Extend scalar evolution to handle >= and <= if a loop is known to be finite and the induction variable guards the condition. Specifically, with these assumptions lhs <= rhs is equivalent to lhs < rhs + 1 and lhs >= rhs to lhs > rhs -1.

In the case of lhs <= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmax, which would have resulted in an infinite loop.

In the case of lhs >= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmin, which would again have resulted in an infinite loop.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D118090

2 years ago[AttrDocs] Fix docs for the sycl_special_class attribute after D114483
Fangrui Song [Fri, 28 Jan 2022 22:30:49 +0000 (14:30 -0800)]
[AttrDocs] Fix docs for the sycl_special_class attribute after D114483

Fixes `AttributeReference.rst:6628:Explicit markup ends without a blank line; unexpected unindent.`
for `ninja docs-clang-html`

2 years ago[mlir] Fix build after 83d59e05b201
Alexandre Ganea [Fri, 28 Jan 2022 22:21:15 +0000 (17:21 -0500)]
[mlir] Fix build after 83d59e05b201

Differential Revision: https://reviews.llvm.org/D118510

2 years ago[UpdateTestChecks] Add --filter and --filter-out options
David Greene [Wed, 19 Jan 2022 17:33:17 +0000 (09:33 -0800)]
[UpdateTestChecks] Add --filter and --filter-out options

Enhance the various update_*_test_checks.py tools to allow filtering the tool
output with regular expressions.  The --filter option will emit only tool output
lines matching the given regular expression while the --filter-out option will
emit only tools output lines not matching the given regular expression.  Filters
are applied in order of appearance on the command line (or in UTC_ARGS) and the
first matching filter terminates the search.

This allows test authors to create more focused tests by removing irrelevant
tool output and checking only the pieces of output necessary to test the desired
functionality.

Differential Revision: https://reviews.llvm.org/D117694

2 years ago[flang] Initial lowering for empty program
Valentin Clement [Fri, 28 Jan 2022 21:39:44 +0000 (22:39 +0100)]
[flang] Initial lowering for empty program

This patch enable lowering from Fortran to FIR for a basic empty
program. It brings all the infrastructure needed for that. As discussed
previously, this is the first patch for lowering and follow up patches
should be smaller.

With this patch we can lower the following code:

```
program basic
end program
```

To a the FIR equivalent:

```
func @_QQmain() {
  return
}
```

Follow up patch will add lowering of more complex constructs.

Reviewed By: kiranchandramohan, schweitz, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D118436

2 years ago[flang][NFC] Remove obsolete IntrinsicCall helper
Valentin Clement [Fri, 28 Jan 2022 21:37:36 +0000 (22:37 +0100)]
[flang][NFC] Remove obsolete IntrinsicCall helper

Remove obsolete code that has moved to the
`flang/Optimizer/Builder/Intrinsic` directory.

`genMin` is inlined in the code since it's not available
in the builder.

Reviewed By: kiranchandramohan, schweitz

Differential Revision: https://reviews.llvm.org/D118465

2 years ago[mlir][sparse][pytaco] enable dimension ordering syntax
Aart Bik [Fri, 28 Jan 2022 18:52:28 +0000 (10:52 -0800)]
[mlir][sparse][pytaco] enable dimension ordering syntax

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D118500

2 years ago[clang-format] Fix misaligned trailing comments in the presence of an empty block...
Marek Kurdej [Fri, 28 Jan 2022 09:37:22 +0000 (10:37 +0100)]
[clang-format] Fix misaligned trailing comments in the presence of an empty block comment.

Fixes https://github.com/llvm/llvm-project/issues/53441.

Expected code:
```
/**/   //
int a; //
```

was before misformatted to:
```
/**/     //
int a; //
```

Because the "remaining length" (after the starting `/*`) of an empty block comment `/**/` was computed to be 0 instead of 2.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D118475

2 years agoRemove reference type when checking const structs
Weverything [Fri, 14 Jan 2022 23:42:36 +0000 (15:42 -0800)]
Remove reference type when checking const structs

ConstStructBuilder::Finalize in CGExprConstant.ccp assumes that the
passed in QualType is a RecordType.  In some instances, the type is a
reference to a RecordType and the reference needs to be removed first.

Differential Revision: https://reviews.llvm.org/D117376

2 years ago[CUDA][HIP] Do not treat host var address as constant in device compilation
Yaxun (Sam) Liu [Tue, 25 Jan 2022 04:49:07 +0000 (23:49 -0500)]
[CUDA][HIP] Do not treat host var address as constant in device compilation

Currently clang treats host var address as constant in device compilation,
which causes const vars initialized with host var address promoted to
device variables incorrectly and results in undefined symbols.

This patch fixes that.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D118153

Fixes: SWDEV-309881

Change-Id: I0a69357063c6f8539ef259c96c250d04615f4473

2 years ago[polly][unittests] Link DeLICMTests with libLLVMCore
Rainer Orth [Fri, 28 Jan 2022 20:58:40 +0000 (21:58 +0100)]
[polly][unittests] Link DeLICMTests with libLLVMCore

A `-DBUILD_SHARED_LIBS=ON` build on Solaris/amd64 failed with

  Undefined                       first referenced
   symbol                             in file
  _ZNK4llvm3cfg6UpdateIPNS_10BasicBlockEE4dumpEv tools/polly/unittests/DeLICM/CMakeFiles/DeLICMTests.dir/DeLICMTest.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-stage2-shared-A/bin/../lib/libLLVMCore.so.14git)
  ld: fatal: symbol referencing errors

Solaris `ld` requires to directly link with dependant libraries, so this
patch explicitly adds `libLLVMCore`.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D118452

2 years ago[SLP] Use moveBefore to simplify code [NFC]
Philip Reames [Fri, 28 Jan 2022 20:43:56 +0000 (12:43 -0800)]
[SLP] Use moveBefore to simplify code [NFC]

2 years ago[ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.
Ahmed Bougacha [Fri, 28 Jan 2022 19:55:53 +0000 (11:55 -0800)]
[ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.

Currently, the clang.arc.attachedcall bundle takes an optional function
argument.  Depending on whether the argument is present, calls with this
bundle have the following semantics:

- on x86, with the argument present, the call is lowered to:
    call _target
    mov rax, rdi
    call _objc_retainAutoreleasedReturnValue

- on AArch64, without the argument, the call is lowered to:
    bl _target
    mov x29, x29

  and the objc runtime call is expected to be emitted separately.

That's because, on x86, the objc runtime checks for both the mov and
the call on x86, and treats the combination as the ARC autorelease elision
marker.

But on AArch64, it only checks for the dedicated NOP marker, as that's
historically been sufficiently unique.  Thanks to that, the runtime call
wasn't required to be adjacent to the NOP marker, so it wasn't emitted
as part of the bundle sequence.

This patch unifies both architectures: on AArch64, we now emit all
3 instructions for the bundle.  This guarantees that the runtime call
is adjacent to the marker in the sequence, and that's information the
runtime can use to further optimize this.

This helps simplify some of the handling, in particular
BundledRetainClaimRVs, which no longer needs to know whether the bundle
is sufficient or not: it now always should be.

Note that this does not include an AutoUpgrade for the nullary bundles,
as they are only produced in ObjCContract as part of the obj/asm emission
pipeline, and are not expected to be in bitcode.

Differential Revision: https://reviews.llvm.org/D118214

2 years ago[BOLT] Imported llvm-bolt-wrapper script
Amir Ayupov [Wed, 24 Feb 2021 20:46:53 +0000 (12:46 -0800)]
[BOLT] Imported llvm-bolt-wrapper script

Commit history in chronological order:

[BOLT] llvm-bolt-wrapper: added wrapper for bolt binary matching

Summary:
Wrapper to compare two versions of BOLT to see if they produce the same output
binary given the same input.

(cherry picked from FBD26626137)

[BOLT] llvm-bolt-wrapper: support for no-output tests and heatmap mode

Summary:
- Added an option `skip_binary_cmp` to support invocations that don't output
  a binary
- Minor fixes for heatmap mode, timeout, log comparison
- Rearranged in-line config example to be copy-pasteable

(cherry picked from FBD26822016)

[BOLT] llvm-bolt-wrapper: merge stdout/stderr, search for config in script dir

(cherry picked from FBD27529335)

[BOLT] llvm-bolt-wrapper: handle /dev/null

Summary:
Fixed the wrapper to preserve `-o /dev/null` and skip binary matching for such
invocations.

(cherry picked from FBD28013747)

[BOLT] llvm-bolt-wrapper: handle cases where output binary doesn't exist

Summary:
Handle invocations where output binary is not generated (e.g. due to an expected
assertion or exit with BOLT-ERROR) and skip binary comparison in such cases.

(cherry picked from FBD28080158)

[BOLT] llvm-bolt-wrapper: handle boltdiff mode

Summary:
Handle `llvm-boltdiff` invocation similarly to `perf2bolt`

(cherry picked from FBD28080157)

[BOLT] llvm-bolt-wrapper: find section with mismatch

Summary:
For mismatching ELF files, find section with mismatch and print sections table
with highlighted mismatch section.

(cherry picked from FBD28087231)

[BOLT] llvm-bolt-wrapper: ignore-build-id in perf2bolt mode

Summary:
When perf2bolt fails to match build-id from perf output for cmp binary, we need
to use -ignore-build-id option to override the strict checking behavior.

(cherry picked from FBD28087232)

[BOLT] llvm-bolt-wrapper: suppress -bolt-info=0 in heatmap mode

Summary:
Heatmap mode is incompatible with `-bolt-info=0` used to suppress binary
differences. Remove it.

(cherry picked from FBD28087230)

[BOLT] llvm-bolt-wrapper: add config-generator mode

Summary:
llvm-bolt-wrapper config can be generated by the script itself.
It makes the workflow more reliable compared to preparing the config manually.

(cherry picked from FBD28358939)

[BOLT] llvm-bolt-wrapper: fix mismatch reporting

Summary:
1. Fixed header comparison issue where headers were skipped due to
  `skip_end == 0` (`lst[:-n]` does not work if n==0).
2. Detect color support while printing mismatching section:
  - use bold color if terminal supports ANSI escape codes,
  - otherwise print ">" at mismatching section.
3. Remove extra 0x before mismatching offset.

(cherry picked from FBD28691979)

[BOLT] llvm-bolt-wrapper: handle perf2bolt tests with ignore-build-id

Summary:
`ignore-build-id` must be passed not more than once. Account for that.

(cherry picked from FBD29830266)

[BOLT] llvm-bolt-wrapper: fix running subprocesses in parallel

Summary:
The commands were running sequentially due to the use of blocking `communicate`
call, which is needed when stdout/stderr are directed to a pipe.
Fix this behavior by directing the output to a file.

(cherry picked from FBD29951863)

2 years ago[GVN] Add tests with redundant load of pointer select.
Florian Hahn [Fri, 28 Jan 2022 20:15:32 +0000 (20:15 +0000)]
[GVN] Add tests with redundant load of pointer select.

Additional test cases for D118144.

2 years ago[libc] Add missing sqrt deps for layering checks
Jordan Rupprecht [Fri, 28 Jan 2022 20:07:19 +0000 (12:07 -0800)]
[libc] Add missing sqrt deps for layering checks

2 years agoRevert "[SLP] Add a clarifying assert in block scheduling [NFC]"
Philip Reames [Fri, 28 Jan 2022 20:07:39 +0000 (12:07 -0800)]
Revert "[SLP] Add a clarifying assert in block scheduling [NFC]"

This reverts commit db49a78900f5e4b59714565876b5dbb5e2dfe840.  The reasoning in the patch applied to a downstream branch, and I got myself confused when trying to split apart pieces.  Thankfully, the assert was simply weaker than the actual invariant currently upstream which is that ReadyInsts is not empty.

2 years agoAdd vector.scan op
harsh [Fri, 28 Jan 2022 20:07:35 +0000 (20:07 +0000)]
Add vector.scan op

This patch adds the vector.scan op which computes the
scan for a given n-d vector. It requires specifying the operator,
the identity element and whether the scan is inclusive or
exclusive.

TEST: Added test in ops.mlir

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D117171

2 years ago[libc] Enable creat, fsync, open, openat, read and write for aarch64.
Siva Chandra [Fri, 28 Jan 2022 19:41:26 +0000 (11:41 -0800)]
[libc] Enable creat, fsync, open, openat, read and write for aarch64.

2 years agoAdd BITINT_MAXWIDTH support
Aaron Ballman [Fri, 28 Jan 2022 20:00:20 +0000 (15:00 -0500)]
Add BITINT_MAXWIDTH support

Part of the _BitInt feature in C2x
(http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2763.pdf) is a new
macro in limits.h named BITINT_MAXWIDTH that can be used to determine
the maximum width of a bit-precise integer type. This macro must expand
to a value that is at least as large as ULLONG_WIDTH.

This adds an implementation-defined macro named __BITINT_MAXWIDTH__ to
specify that value, which is used by limits.h for the standard macro.

This also limits the maximum bit width to 128 bits because backends do
not currently support all mathematical operations (such as division) on
wider types yet. This maximum is expected to be increased in the future.