Commit Graph

412176 Commits

Author SHA1 Message Date
Craig Topper 413684313d [RISCV] Adjust the header comment in RISCVInstrInfoZb.td to better integrate Zbk* extensions.
The Zbk* extensions have some overlap with Zb so have been placed in this file.

Reviewed By: VincentWu

Differential Revision: https://reviews.llvm.org/D117958
2022-01-23 11:42:52 -08:00
Groverkss ad36f37ce2 [MLIR][Presburger] Clean PresburgerSet identifier interface to match IntegerPolyhedron's interface
This patch changes names of identifiers and their corresponding getters in
PresburgerSet to match those of IntegerPolyhedron.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D117998
2022-01-24 01:09:07 +05:30
Kazu Hirata f8ddcb4131 [Object] Remove a redundant return statement (NFC)
Identified with readability-redundant-control-flow.
2022-01-23 11:07:16 -08:00
Kazu Hirata abb0ed4495 [Commands] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
2022-01-23 11:07:14 -08:00
Kazu Hirata 7a29b0b583 [llvm] Fix header guards (NFC)
Identified with llvm-header-guard.
2022-01-23 11:07:12 -08:00
Nuno Lopes 1a5dea9e2b [NewGVN][NFC] precommit tests for PR53277 2022-01-23 19:06:21 +00:00
Fangrui Song 8e382ae91b [Support] Simplify parallelForEach{,N}
* Merge parallel_for_each into parallelForEach (this removes 1 `Fn(...)` call)
* Change parallelForEach to use parallelForEachN
* Move parallelForEachN into Parallel.cpp

My x86-64 `lld` executable is 100KiB smaller.
No noticeable difference in performance.

Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D117510
2022-01-23 10:35:44 -08:00
Casey Carter 818cfb10c5 [libcxx][test] Make MSVC `<charconv>` test compile when testing MSVC
<meme>How many layers of irony are you on?</meme>

Differential Revision: https://reviews.llvm.org/D117967
2022-01-23 10:12:53 -08:00
Simon Pilgrim f69379d0a4 [InstCombine] Add test coverage for PR48683
D108992 added self-multiply handling to KnownBits::mul but we don't use it yet..
2022-01-23 18:03:17 +00:00
Craig Topper 0b79979180 [RISCV] Merge some rvv intrinsic test cases that only differ by XLen type.
Instead of having a test for i32 XLen and i64 XLen, use sed to
replace iXLen with i32/i64 before running llc.

This change covers all of the floating point tests.
2022-01-23 09:36:14 -08:00
Simon Pilgrim accc07e654 [DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero (PR51312)
Fixes parity codegen issue where we know all but the lowest bit is zero, we can replace the ICMPNE with 0 comparison with a ext/trunc

Differential Revision: https://reviews.llvm.org/D117983
2022-01-23 16:36:25 +00:00
LLVM GN Syncbot 631f3e6215 [gn build] Port d2e8fb3318 2022-01-23 16:30:34 +00:00
Simon Pilgrim 6605057992 Revert rG7c66aaddb128dc0f342830c1efaeb7a278bfc48c "[DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero (PR51312)"
Noticed a typo in the getBooleanContents call just after I pressed commit :(
2022-01-23 16:28:44 +00:00
Richard d2e8fb3318 [clang-tidy] Add readability-duplicate-include check
Looks for duplicate includes and removes them.

Every time an include directive is processed, check a vector of filenames
to see if the included file has already been included.  If so, it issues
a warning and a replacement to remove the entire line containing the
duplicated include directive.

When a macro is defined or undefined, the vector of filenames is cleared.
This enables including the same file multiple times, but getting
different expansions based on the set of active macros at the time of
inclusion.  For example:

  #undef NDEBUG
  #include "assertion.h"
  // ...code with assertions enabled

  #define NDEBUG
  #include "assertion.h"
  // ...code with assertions disabled

Since macros are redefined between the inclusion of assertion.h,
they are not flagged as redundant.

Differential Revision: https://reviews.llvm.org/D7982
2022-01-23 09:23:04 -07:00
Sanjay Patel 2e26633af0 [IR] document and update ctlz/cttz intrinsics to optionally return poison rather than undef
The behavior in Analysis (knownbits) implements poison semantics already,
and we expect the transforms (for example, in instcombine) derived from
those semantics, so this patch changes the LangRef and remaining code to
be consistent. This is one more step in removing "undef" from LLVM.

Without this, I think https://github.com/llvm/llvm-project/issues/53330
has a legitimate complaint because that report wants to allow subsequent
code to mask off bits, and that is allowed with undef values. The clang
builtins are not actually documented anywhere AFAICT, but we might want
to add that to remove more uncertainty.

Differential Revision: https://reviews.llvm.org/D117912
2022-01-23 11:22:48 -05:00
Simon Pilgrim 7c66aaddb1 [DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero (PR51312)
Fixes parity codegen issue where we know all but the lowest bit is zero, we can replace the ICMPNE with 0 comparison with a ext/trunc

Differential Revision: https://reviews.llvm.org/D117983
2022-01-23 16:20:42 +00:00
Ayke van Laethem 116ab78694
[AVR] Make use of the constant value 0 in R1
The register R1 is defined to have the constant value 0 in the avr-gcc
calling convention (which we follow). Unfortunately, we don't really
make use of it. This patch replaces `LDI 0` instructions with a copy
from R1.

This reduces code size: my AVR build of compiler-rt goes from 50660 to
50240 bytes of code size, which is a 0.8% reduction. Presumably it will
also improve execution speed, although I didn't measure this.

Differential Revision: https://reviews.llvm.org/D117425
2022-01-23 17:08:01 +01:00
Ayke van Laethem 153359180a
[AVR] Remove regalloc workaround for LDDWRdPtrQ
Background: https://github.com/avr-rust/rust-legacy-fork/issues/126

In short, this workaround was introduced to fix a "ran out of registers
during regalloc" issue. The root cause has since been fixed in
https://reviews.llvm.org/D54218 so this workaround can be removed.

There is one test that changes a little bit, removing a single
instruction. I also compiled compiler-rt before and after this patch but
didn't see a difference. So presumably the impact is very low. Still,
it's nice to be able to remove such a workaround.

Differential Revision: https://reviews.llvm.org/D117831
2022-01-23 17:08:00 +01:00
Carlos Galvez eb3f20e8fa [clang-tidy] Remove gsl::at suggestion from cppcoreguidelines-pro-bounds-constant-array-index
Currently the fix hint is hardcoded to gsl::at(). This poses
a problem for people who, for a number of reasons, don't want
or cannot use the GSL library (introducing a new third-party
dependency into a project is not a minor task).

In these situations, the fix hint does more harm than good
as it creates confusion as to what the fix should be. People
can even misinterpret the fix "gsl::at" as e.g. "std::array::at",
which can lead to even more trouble (e.g. when having guidelines
that disallow exceptions).

Furthermore, this is not a requirement from the C++ Core Guidelines.
simply that array indexing needs to be safe. Each project should
be able to decide upon a strategy for safe indexing.

The fix-it is kept for people who want to use the GSL library.

Differential Revision: https://reviews.llvm.org/D117857
2022-01-23 15:52:42 +00:00
Simon Pilgrim d4ed3eff9f [X86] Add vector signbit parity checks for non-popcnt targets
Noticed while looking at D117983 - we miss some parity patterns with/without popcnt
2022-01-23 15:34:48 +00:00
Arthur O'Dwyer 5d78fef6db [libc++] Fix LWG3437 "__cpp_lib_polymorphic_allocator is in the wrong header"
https://cplusplus.github.io/LWG/issue3437

Differential Revision: https://reviews.llvm.org/D117963
2022-01-23 10:30:09 -05:00
Arthur O'Dwyer 938944445a [libc++] Mark LWG3541 as "Complete". NFC.
Differential Revision: https://reviews.llvm.org/D117956
2022-01-23 10:15:17 -05:00
Simon Pilgrim 49d38b1d61 Fix "not all control paths return a value" warning. NFC. 2022-01-23 15:14:10 +00:00
Simon Pilgrim d13847bbe5 [lldb] TerminalState::Save - fix unused variable warning
Non-POSIX target builds don't use the file descriptor
2022-01-23 15:12:44 +00:00
Simon Pilgrim d7aa402b4b [lldb] PdbAstBuilder - 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
2022-01-23 15:11:08 +00:00
Simon Pilgrim c93491352c [lldb] CxxModuleHandler - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr
2022-01-23 15:10:33 +00:00
Simon Pilgrim df0fd1c301 [clangd] Use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr
2022-01-23 13:24:36 +00:00
Simon Pilgrim 86497026a2 [clang-tidy] Use cast<>/castAs<> instead of dyn_cast<>/getAs<> to avoid dereference of nullptr
The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr
2022-01-23 12:57:12 +00:00
Simon Pilgrim 946f29028e [llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr
2022-01-23 12:50:12 +00:00
Simon Pilgrim 20d46fbd4a [CodeGenPrepare] Use dyn_cast result to check for null pointers
Simplifies logic and helps the static analyzer correctly check for nullptr dereferences
2022-01-23 12:47:52 +00:00
Simon Pilgrim ff05b93a02 [llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointers are always dereferenced immediately, so assert the cast is correct instead of returning nullptr
2022-01-23 12:45:12 +00:00
Simon Pilgrim a4f2025492 [X86] Regenerate avx512-mask-op.ll
Noticed on D86578 - several of the test cases were missing checks as they didn't start on a newline so the update script couldn't see them
2022-01-23 11:34:25 +00:00
Alex Brachet 3dc6fd5151 [llvm-objcopy][MachO] Implement --update-section
Implements `--update-section` which is currently supported for ELF for Mach-O as well

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D117281
2022-01-23 09:47:45 +00:00
Craig Topper be6070c290 [RISCV] Use FP ABI for some RVV intrinsic tests. NFC
Removes moves from GPR to FPR and improves f64 tests on RV32.

Differential Revision: https://reviews.llvm.org/D117969
2022-01-22 22:06:33 -08:00
Craig Topper 85e42db1b6 [RISCV] Merge some rvv intrinsic test cases that only differ by XLen type.
Instead of having a test for i32 XLen and i64 XLen, use sed to
replace iXLen with i32/i64 before running llc.

This change updates tests for intrinsics that operate exclusively
on mask values. It removes over 4000 lines worth of test content.
More merging will come in future changes.

Differential Revision: https://reviews.llvm.org/D117968
2022-01-22 21:55:29 -08:00
eopXD 3cf15af2da [RISCV] Remove experimental prefix from rvv-related extensions.
Extensions affected: +v, +zve*, +zvl*

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D117860
2022-01-22 20:18:40 -08:00
Joe Loser 2513b79030
[libc++] Implement LWG3549: view_interface need not inherit from view_base
Implement LWG3549 by making `view_interface` not inherit from `view_base`. Types
are still views if they have a public and unambiguous derivation from
`view_interface`, so adjust the `enable_view` machinery as such to account for
that.

Differential Revision: https://reviews.llvm.org/D117714
2022-01-22 22:52:46 -05:00
Phoebe Wang 37d1d02200 [X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC
MSVC currently doesn't support 80 bits long double. ICC supports it when
the option `/Qlong-double` is specified. Changing the alignment of f80
to 16 bytes so that we can be compatible with ICC's option.

Reviewed By: rnk, craig.topper

Differential Revision: https://reviews.llvm.org/D115942
2022-01-23 09:58:46 +08:00
Dave b846795240 [docs] [clang] Small documentation change for compilation databases
We have an page dedicated to compliation databases including
various ways to generate them, but we don't mention that clang
has a built in method to do this.  This addresses that.

Reviewed By: joerg

Differential Revision: https://reviews.llvm.org/D116882
2022-01-22 17:30:34 -08:00
Malhar Jajoo c1988dbf2d [openmp] Allow x87 fp functions only in Openmp runtime for x86.
This patch allows Openmp runtime atomic functions operating on x87 high-precision
to be present only in Openmp runtime for x86 architectures

The functions affected are:

__kmpc_atomic_10
__kmpc_atomic_20
__kmpc_atomic_cmplx10_add
__kmpc_atomic_cmplx10_div
__kmpc_atomic_cmplx10_mul
__kmpc_atomic_cmplx10_sub
__kmpc_atomic_float10_add
__kmpc_atomic_float10_div
__kmpc_atomic_float10_mul
__kmpc_atomic_float10_sub

__kmpc_atomic_float10_add_fp
__kmpc_atomic_float10_div_fp
__kmpc_atomic_float10_mul_fp
__kmpc_atomic_float10_sub_fp
__kmpc_atomic_float10_max
__kmpc_atomic_float10_min

Differential Revision: https://reviews.llvm.org/D117473
2022-01-22 22:09:44 +00:00
John Ericson 7c16647c36 [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484
2022-01-22 20:57:21 +00:00
Sanjay Patel 39e602b6c4 [InstCombine] try to fold binop with phi operands
This is an alternate version of D115914 that handles/tests all binary opcodes.

I suspect that we don't see these patterns too often because -simplifycfg
would convert the minimal cases into selects rather than leave them in phi form
(note: instcombine has logic holes for combining the select patterns too though,
so that's another potential patch).

We only create a new binop in a predecessor that unconditionally branches to
the final block.
https://alive2.llvm.org/ce/z/C57M2F
https://alive2.llvm.org/ce/z/WHwAoU (not safe to speculate an sdiv for example)
https://alive2.llvm.org/ce/z/rdVUvW (but it is ok on this path)

Differential Revision: https://reviews.llvm.org/D117110
2022-01-22 15:00:06 -05:00
Craig Topper d44b6be6ea [RISCV] Don't Custom legalize f16/f32/f64 bitcasts if those types aren't Legal. 2022-01-22 11:55:18 -08:00
John Ericson 0a6b4258ab [openmp][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.

Differential Revision: https://reviews.llvm.org/D117945
2022-01-22 18:05:36 +00:00
Peter Klausler 896a543e72 [flang] Support DECIMAL='COMMA' mode in namelist I/O
DECIMAL='COMMA' mode affects item separators, real editing, and
complex editing.

Differential Revision: https://reviews.llvm.org/D117906
2022-01-22 09:01:36 -08:00
Peter Klausler e9d0f8baf2 [flang] Don't drop format string for external child I/O
In user-defined derived type I/O to an external unit, don't
omit the format string from the constructor of ChildFormattedIoStatement.
And include any user IOMSG text in the crash message of the
parent, if it doesn't catch errors.

Differential Revision: https://reviews.llvm.org/D117903
2022-01-22 09:01:02 -08:00
Arthur O'Dwyer 26fffc1b8e [libc++] [test] {cpo,niebloid}.compile.pass.cpp: Also test their constness.
This will detect if someone writes `inline auto cpo =` instead of
`inline constexpr auto cpo =`. I don't know how that'd be possible,
but it's easy to test, so let's test it.
2022-01-22 11:53:00 -05:00
Florian Hahn 5f2854f1da
[LV] Always create VPWidenCanonicalIVRecipe, optimize away later.
This patch updates createBlockInMask to always generate
VPWidenCanonicalIVRecipe and adds a transform to optimize it away later,
if it is not needed.

This is a step towards breaking up VPWidenIntOrFpInductionRecipe and
explicitly distinguishing between vector phis and scalarizing.

Split off from D116123.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D117140
2022-01-22 15:34:20 +00:00
Qiu Chaofan 00d68c3824 [PowerPC] Support parsing GNU attributes in MC
This patch is the first step to enable support of GNU attribute in LLVM
PowerPC, enabling it for PowerPC targets, otherwise llvm-mc raises error
when seeing the attribute section.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D115854
2022-01-22 23:29:34 +08:00
Qiu Chaofan 8dedf9b58b [PowerPC] Change CTR clobber estimation for 128-bit floating types
Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D117459
2022-01-22 23:20:14 +08:00