Sean Fertile [Mon, 17 Jan 2022 21:20:28 +0000 (16:20 -0500)]
[PowerPC][AIX] Fallback to DAG-ISEL if global has toc-data attribute.
FAST-ISEL should fall back to DAG-ISEL when a global variable has the
toc-data attribute. A number of the checks were duplicated in the lit
test becuase of
1) Slightly different output between -O0 and -O2 due to FAST-ISEL vs
DAG-ISEL codegen.
2) In preperation of a peephole optimization that will run when
optimizations are enabled.
Differential Revision: https://reviews.llvm.org/D115373
Benjamin Kramer [Mon, 17 Jan 2022 20:48:00 +0000 (21:48 +0100)]
[AsyncToLLVM] aligned_alloc requires the size to be a multiple of aignment, so round up
Fixes a crash with debug malloc.
Sanjay Patel [Mon, 17 Jan 2022 19:34:24 +0000 (14:34 -0500)]
[AArch64][x86] add tests for bswap demanded bits; NFC
Philip Reames [Mon, 17 Jan 2022 20:19:44 +0000 (12:19 -0800)]
[LoopDeletion] Add back statistic update lost in 523573e
Caught by a couple of builders as an unused variable warning (e.g. https://lab.llvm.org/buildbot#builders/57/builds/13973).
Fabian Wolff [Mon, 17 Jan 2022 20:10:22 +0000 (21:10 +0100)]
[clang-tidy] Fix false positives involving type aliases in `misc-unconventional-assign-operator` check
clang-tidy currently reports false positives even for simple cases such as:
```
struct S {
using X = S;
X &operator=(const X&) { return *this; }
};
```
This is due to the fact that the `misc-unconventional-assign-operator` check fails to look at the //canonical// types. This patch fixes this behavior.
Reviewed By: aaron.ballman, mizvekov
Differential Revision: https://reviews.llvm.org/D114197
Nikolas Klauser [Mon, 17 Jan 2022 18:56:23 +0000 (19:56 +0100)]
[libc++] Install clang-tidy in docker containers
Install clang-tidy
Reviewed By: ldionne, #libc
Spies: sammccall, mgorny, libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D117268
John Ericson [Sun, 16 Jan 2022 06:07:13 +0000 (06:07 +0000)]
[pstl][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D117418
Fangrui Song [Mon, 17 Jan 2022 20:04:30 +0000 (12:04 -0800)]
[Support] Fix -Wreturn-type in LLVM_ENABLE_THREADS=OFF build after D116846
Fabian Wolff [Mon, 17 Jan 2022 19:50:32 +0000 (20:50 +0100)]
[clang-tidy] Fix `readability-redundant-declaration` false positive for template friend declaration
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=48086 | PR#48086 ]]. The problem is that the current matcher uses `hasParent()` to detect friend declarations, but for a template friend declaration, the immediate parent of the `FunctionDecl` is a `FunctionTemplateDecl`, not the `FriendDecl`. Therefore, I have replaced the matcher with `hasAncestor()`.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D114299
Philip Reames [Mon, 17 Jan 2022 19:39:19 +0000 (11:39 -0800)]
[LoopDeletion] Revert 3af8a11 and add test coverage for breakage
This reverts 3af8a11 because I'd used an upper bound where an lower bound was required. The included reduced test case demonstrates the issue.
Nicolas Vasilache [Fri, 14 Jan 2022 16:18:06 +0000 (16:18 +0000)]
Revert "[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface"
This reverts commit
c8f5735301993c363c16ce5ddda6f1f6cb968090.
The integration tests are broken.
Nikolas Klauser [Mon, 17 Jan 2022 18:25:21 +0000 (19:25 +0100)]
[libc++] Introduce __debug_db_insert_i()
Introduce `__debug_db_insert_i()`
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D117410
Arthur O'Dwyer [Mon, 17 Jan 2022 17:06:06 +0000 (12:06 -0500)]
[libc++] [bench] Stop using uniform_int_distribution<char> in benchmarks.
Reviewed as part of D114920.
Arthur O'Dwyer [Mon, 17 Jan 2022 19:29:09 +0000 (14:29 -0500)]
[libc++] [doc] Fix a Sphinx error in ReleaseNotes.rst (I hope)
Simon Pilgrim [Mon, 17 Jan 2022 19:02:44 +0000 (19:02 +0000)]
[X86] Add test case for PR53247
Test case from Issue #53247
Akshay Kumar [Mon, 17 Jan 2022 16:39:22 +0000 (22:09 +0530)]
[Aarch64] Customer lowering of COPYSIGN to SIMD should check for NEON availability
For the following test case, clang is crashing for ARM64 architecture
$ cat crash.c
double crash(double a, double b)
{
return __builtin_copysign(a, b);
}
$ clang -O2 -march=armv8-a+nosimd --target=arm64 -S crash.c -o /dev/null
fatal error: error in backend: Cannot select: 0x7fae361bb4e8: v2i64 = AArch64ISD::BIT 0x7fae361bb210, 0x7fae361bb278, 0x7fae361bb480
Fix: PR51806
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D116581
Nikolas Klauser [Mon, 17 Jan 2022 18:45:42 +0000 (19:45 +0100)]
[libc++][P2321R2] Add specializations of basic_common_reference and common_type for tuple
Add specializations of `basic_common_reference` and `common_type` for `tuple`
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D116538
Nikolas Klauser [Sat, 15 Jan 2022 19:23:29 +0000 (20:23 +0100)]
[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <vector>
Use `_LIBCPP_DEBUG_ASSERT` in `<vector>`
Reviewed By: Quuxplusone, ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D117402
Fangrui Song [Mon, 17 Jan 2022 18:25:07 +0000 (10:25 -0800)]
[ELF] Change std::vector<InputSectionBase *> to SmallVector
There is no remaining std::vector<InputSectionBase> now. My x86-64 lld
executable is 2KiB small.
Benjamin Kramer [Mon, 17 Jan 2022 17:23:44 +0000 (18:23 +0100)]
[AsyncToLLVM] Align frames to 64 bytes
Coroutine lowering always takes the natural alignment when spilling to
the frame (issue #53148) so using AVX2 or AVX512 in a coroutine doesn't
work. Always overalign to 64 bytes to avoid this issue until we have a
better solution.
Differential Revision: https://reviews.llvm.org/D117501
Nicolas Vasilache [Fri, 14 Jan 2022 17:18:37 +0000 (17:18 +0000)]
[mlir][Linalg] NFC - Cleanup conv1d generators
Differential Revision: https://reviews.llvm.org/D117330
Dmitry Preobrazhensky [Mon, 17 Jan 2022 17:29:10 +0000 (20:29 +0300)]
[AMDGPU][GFX10][MC] Updated symbolic names of internal HW registers
GFX10 no longer support HW_ID. It has been replaced with HW_ID1 and HW_ID2.
See bug 52904: https://github.com/llvm/llvm-project/issues/52904
Differential Revision: https://reviews.llvm.org/D117313
Dmitry Preobrazhensky [Mon, 17 Jan 2022 17:16:18 +0000 (20:16 +0300)]
[AMDGPU][MC] Corrected disassembly of s_waitcnt
s_waitcnt with default expcnt, vmcnt and lgkmcnt values was disassembled without arguments.
See https://github.com/llvm/llvm-project/issues/52716
Differential Revision: https://reviews.llvm.org/D117305
Stephen Tozer [Mon, 17 Jan 2022 11:42:35 +0000 (11:42 +0000)]
[DebugInfo] ValueMapper impl for DIArgList respects IgnoreMissingLocals
This patch fixes an issue in which SSA value reference within a
DIArgList would be unnecessarily dropped by llvm-link, even when
invoking on a single file (which should be a no-op). The reason for the
difference is that the ValueMapper does not refer to the
RF_IgnoreMissingLocals flag for LocalAsMetadata contained within a
DIArgList; this flag is used for direct LocalAsMetadata uses to preserve
SSA references even when the ValueMapper does not have an explicit
mapping for the referenced SSA value, which appears to always be the
case when using llvm-link in this manner.
Differential Revision: https://reviews.llvm.org/D114355
Micah Weston [Mon, 17 Jan 2022 17:17:15 +0000 (17:17 +0000)]
[AArch64] Revive optimize add/sub with immediate through MIPeepholeOpt
Fixes the build issue with D111034, whose goal was to optimize
add/sub with long immediates.
Optimize ([add|sub] r, imm) -> ([ADD|SUB] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.
Optimize ([add|sub] r, imm) -> ([SUB|ADD] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.
The change which fixed the build issue in D111034 was the use of new virtual
registers so that SSA form is maintained until deleting MI.
Differential Revision: https://reviews.llvm.org/D117429
Bjorn Pettersson [Sun, 16 Jan 2022 00:18:29 +0000 (01:18 +0100)]
[test] Use opt -passes syntax in DeadArgElim lit tests. NFC
The legacy PM is deprecated, so update a bunch of lit tests running
opt to use the new PM syntax when specifying the pipeline.
Nicolas Vasilache [Mon, 17 Jan 2022 17:07:46 +0000 (17:07 +0000)]
[mlir][Linalg] Relax PadTensor tiling constraints and expose it to strategies.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D117334
Arthur O'Dwyer [Sun, 16 Jan 2022 17:32:33 +0000 (12:32 -0500)]
[libc++] [test] Improve the tests for std::assignable_from.
Fixes #50060.
Differential Revision: https://reviews.llvm.org/D117434
Nicolas Vasilache [Fri, 14 Jan 2022 16:18:06 +0000 (16:18 +0000)]
[mlir][Linalg] NFC - Drop vectorization reliance on ConvolutionOpInterface
Differential Revision: https://reviews.llvm.org/D117323
zhijian [Mon, 17 Jan 2022 15:37:08 +0000 (10:37 -0500)]
[AIX] Support of Big archive (read)
Summary:
The patch is based on the EGuesnet's implement of the "Support of Big archive (read)
the first commit of the patch is come from https://reviews.llvm.org/D100651.
the rest of commits of the patch
1 Addressed the comments on the https://reviews.llvm.org/D100651
2 according to https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big
using the "fl_fstmoff" for the first object file number, using "char ar_nxtmem[20]" to get next object file ,
using the "char fl_lstmoff[20]" for the last of the object file will fix the following problems:
2.1 can not correct reading a archive files which has padding data between too object file
2.2 can not correct reading a archive files from which some object file has be deleted
3 introduce a new derived class BigArchive for big ar file.
Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D111889
zhijian [Mon, 17 Jan 2022 16:38:01 +0000 (11:38 -0500)]
Revert "[AIX] Support of Big archive (read)"
This reverts commit
3130134d6e4823b5ee7619288a4b7e1e60831a82.
Jake Egan [Mon, 17 Jan 2022 16:22:33 +0000 (11:22 -0500)]
[AIX][ZOS] Handle unsupported builtin function CFStringMakeConstantString
This patch emits an error on AIX and z/OS because XCOFF and GOFF does not currently implement builtin function `CFStringMakeConstantString`. Tests that use this builtin were also disabled.
Reviewed By: SeanP
Differential Revision: https://reviews.llvm.org/D117315
Marek Kurdej [Fri, 14 Jan 2022 20:59:40 +0000 (21:59 +0100)]
[clang-format] Treat ForEachMacros as loops
TT_ForEachMacro should be considered in rules AllowShortBlocksOnASingleLine
and AllowShortLoopsOnASingleLine.
Fixes https://github.com/llvm/llvm-project/issues/45432.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D94955
Nicolas Vasilache [Fri, 14 Jan 2022 16:08:14 +0000 (16:08 +0000)]
[mlir][Vector] Generalize and improve folding of ExtractOp from Insert/Transpose chain.
This revision fixes a bug where the iterative algorithm would walk back def-use chains to an incorrect operand.
This exposed opportunities for a larger refactoring and behavior improvement.
The new algorithm has improved folding behavior and proceeds by tracking both the
permutation of the extraction position and the internal vector permutation.
Multiple partial intersection cases with a candidate insertOp are supported.
The refactoring of the implementation should also help it generalize to strided insert/extract op.
This also subsumes the previous `foldExtractOpFromTranspose` which is now a simple special case and can be deleted.
Differential Revision: https://reviews.llvm.org/D117322
Simon Pilgrim [Mon, 17 Jan 2022 15:57:50 +0000 (15:57 +0000)]
[MCA][X86] Add missing zero-idioms test file coverage
atom/slm have no/limited zero-idioms handling but we should test all the common instructions anyhow
znver1/znver2 were just missing - I've copied the Haswell tests for consistent test coverage
Nikita Popov [Mon, 17 Jan 2022 15:59:23 +0000 (16:59 +0100)]
[ConstantFold] Don't fold load from non-byte-sized vector
Following up on https://github.com/llvm/llvm-project/commit/
1470f94d71c544327f76b85c55cb6f7cb43a6cbb#r63981173:
The result here (probably) depends on endianness. Don't bother
trying to handle this exotic case, just bail out.
Sanjay Patel [Mon, 17 Jan 2022 15:35:03 +0000 (10:35 -0500)]
[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)
This fold already exists for scalars via FAddCombine (and that's
why 2 of the tests are only changed cosmetically), but that code
misses vectors and has largely been replaced by simpler folds
over time, so this is another step towards removing it.
Sanjay Patel [Mon, 17 Jan 2022 15:03:58 +0000 (10:03 -0500)]
[InstCombine] add tests for fadd+fmul factorization fold; NFC
As shown in the tests, this transform exists partially already.
zhijian [Mon, 17 Jan 2022 15:37:08 +0000 (10:37 -0500)]
[AIX] Support of Big archive (read)
Summary:
The patch is based on the EGuesnet's implement of the "Support of Big archive (read)
the first commit of the patch is come from https://reviews.llvm.org/D100651.
the rest of commits of the patch
1 Addressed the comments on the https://reviews.llvm.org/D100651
2 according to https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big
using the "fl_fstmoff" for the first object file number, using "char ar_nxtmem[20]" to get next object file ,
using the "char fl_lstmoff[20]" for the last of the object file will fix the following problems:
2.1 can not correct reading a archive files which has padding data between too object file
2.2 can not correct reading a archive files from which some object file has be deleted
3 introduce a new derived class BigArchive for big ar file.
Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D111889
Yitzhak Mandelbaum [Fri, 14 Jan 2022 12:57:07 +0000 (12:57 +0000)]
[clang][dataflow] Remove TestingSupport's dependency on gtest
Users outside of the clang repo may use different googletest versions. So, it's
better not to depend on llvm's googletest. This patch removes the dependency by
having `checkDataflow` return an `llvm::Error` instead of calling googletest's
`FAIL` or `ASSERT...` macros.
Differential Revision: https://reviews.llvm.org/D117304
Arthur O'Dwyer [Thu, 2 Dec 2021 00:55:26 +0000 (19:55 -0500)]
[libc++] [test] Improve the test for `uniform_int_distribution<T>`.
Extracted from https://reviews.llvm.org/D114920
David Green [Mon, 17 Jan 2022 15:25:11 +0000 (15:25 +0000)]
[DAG] Extend SearchForAndLoads with any_extend handling
This extends the code in SearchForAndLoads to be able to look through
ANY_EXTEND nodes, which can be created from mismatching IR types where
the AND node we begin from only demands the low parts of the register.
That turns zext and sext into any_extends as only the low bits are
demanded. To be able to look through ANY_EXTEND nodes we need to handle
mismatching types in a few places, potentially truncating the mask to
the size of the final load.
Differential Revision: https://reviews.llvm.org/D117457
Arthur O'Dwyer [Tue, 28 Dec 2021 22:51:55 +0000 (17:51 -0500)]
[libc++] [ABI BREAK] Conform lognormal_distribution::param_type.
Fixes #52906.
Differential Revision: https://reviews.llvm.org/D116344
Arthur O'Dwyer [Sun, 16 Jan 2022 19:56:42 +0000 (14:56 -0500)]
[libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.
Verify that the name of the private submodule matches the name of the detail header.
Differential Revision: https://reviews.llvm.org/D117438
Matt Arsenault [Sat, 15 Jan 2022 20:12:18 +0000 (15:12 -0500)]
AMDGPU: Fix crashing on calls to C functions from graphics contexts
If we had one of the shader calling conventions calling a default
calling convention callee, this would crash when the caller did not
have anything to pass to the workitem ID.
This is illegal, but we still need to produce something
sensible. llvm-reduce likes to replace calls to intrinsics with calls
to null or undef, so this does appear and is helpful to avoid hard
erroring.
Pass undef in this case, as already happened for the other implicit
arguments. It might make sense to define the behavior here and pass
null for the pointers, and -1 for the workitem ID. We do have extra
bits in the workitem ID, so this wouldn't conflict with a valid value.
Matt Arsenault [Wed, 12 Jan 2022 21:28:49 +0000 (16:28 -0500)]
AMDGPU/GlobalISel: Fix selection of constant 32-bit addrspace loads
Unfortunately the selection patterns still rely on the address space
from the memory operand instead of using the pointer type. Add this
address space to the list of cases supported by global-like loads.
Alternatively we would have to adjust the address space of the memory
operand to deviate from the underlying IR value, which looks ugly and
is more work in the legalizer.
This doesn't come up in the DAG path because it uses a different
selection strategy where the cast is inserted during the addressing
mode matching.
Matt Arsenault [Fri, 14 Jan 2022 21:21:24 +0000 (16:21 -0500)]
AMDGPU: Correct getMaxNumSGPR treatment of flat_scratch
This was approximating the entry point logic for flat_scratch_init,
which is not really the point. We need to account for whether we need
to reserve the SGPR pair used for flat_scratch, not whether we needed
the initialization kernel argument. If this was an arbitrary function,
we would end up over-reporting the number of potentially free
SGPRs. The logic for architected flat scratch also only applies to the
initialization in the kernel, not the reserved registers at the end.
Avoids compile failures in a future patch from allocating more SGPRs
than the subtarget supports.
Matt Arsenault [Sun, 16 Jan 2022 15:45:38 +0000 (10:45 -0500)]
AMDGPU/GlobalISel: Fix legalization failure for s65 shifts
This was trying to clamp s65 down to s32, which wasn't handled so we
need to promote all the way to s128 first. Having to order the
legalization rules in just the right way is rather dissatisfying, but
I'm not sure how smart the legalizer should be in trying to interpret
the rules.
Simon Moll [Mon, 17 Jan 2022 13:56:12 +0000 (14:56 +0100)]
[VE] select|vp.merge|vp.select v256 isel and tests
Use the `VMRG` for all three operations for now. `vp_select` will be
used in passthru patterns.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D117206
Matt Arsenault [Sun, 16 Jan 2022 16:14:58 +0000 (11:14 -0500)]
AMDGPU/GlobalISel: Add failing ABI lowering testcases
Matt Arsenault [Wed, 5 Jan 2022 17:09:09 +0000 (12:09 -0500)]
AMDGPU: Fix LiveVariables error after optimizing VGPR ranges
This was not removing the block from the live set depending on the
specific depth first visit order. Fixes a verifier error in the OpenCL
conformance tests.
Matt Arsenault [Sun, 16 Jan 2022 19:24:03 +0000 (14:24 -0500)]
AMDGPU/GlobalISel: Fix test not matching test name
This was testing an s48 load instead of an s64 load as intended.
Matt Devereau [Wed, 5 Jan 2022 13:42:01 +0000 (13:42 +0000)]
[AArch64][SVE] Remove Redundant aarch64.sve.convert.to.svbool
Generated code resulted in redundant aarch64.sve.convert.to.svbool
calls for AArch64 Binary Operations. Narrow the more precise operands
instead of widening the less precise operands
Differential Revision: https://reviews.llvm.org/D116730
Florian Hahn [Mon, 17 Jan 2022 14:32:40 +0000 (14:32 +0000)]
[LV] Add test coverage for reductions with odd interleave counts.
Add test coverage for loops with reductions and odd (3, 5) interleave
counts.
Mubashar Ahmad [Wed, 5 Jan 2022 16:53:59 +0000 (16:53 +0000)]
[Clang][AArch64][ARM] PMUv3 Option Added
An option has been added to Clang to enable or disable
the PMU v3 architecture extension.
Differential Revision: https://reviews.llvm.org/D116748
Sam McCall [Mon, 17 Jan 2022 14:13:27 +0000 (15:13 +0100)]
Re-land [clangd] Elide even more checks in SelectionTree.
This reverts commit
1093b9f2e9842982d97534940a643e3a4657c60b.
Fix added for implicit-include case.
Haojian Wu [Wed, 5 Jan 2022 09:42:45 +0000 (10:42 +0100)]
[clangd] Don't rename on symbols from system headers.
Fixes https://github.com/clangd/clangd/issues/963.
Differential Revision: https://reviews.llvm.org/D116643
Florian Hahn [Mon, 17 Jan 2022 13:59:13 +0000 (13:59 +0000)]
[DSE] Remove commented-out InvisibleToCallerBeforeRet. (NFC)
This code was is a leftover from earlier changes and should be removed.
Sanjay Patel [Sun, 16 Jan 2022 18:36:49 +0000 (13:36 -0500)]
[InstCombine] propagate IR flags from binop through select
The tests with constant folding that produces poison
could potentially remove the select entirely:
https://alive2.llvm.org/ce/z/e-WUqF
...but this patch just removes the FMF-only limitation on
propagation.
Sanjay Patel [Sun, 16 Jan 2022 18:01:43 +0000 (13:01 -0500)]
[InstCombine] add tests for binop with flags and select op; NFC
Sanjay Patel [Sun, 16 Jan 2022 17:44:46 +0000 (12:44 -0500)]
[InstCombine] auto-generate complete test check lines; NFC
Florian Hahn [Sat, 15 Jan 2022 15:57:35 +0000 (15:57 +0000)]
[LV] Make test more robust by adding users of inductions.
The modified tests didn't have actual users of all inductions, making it
trivial to eliminate them. Add users to make sure the inductions are
actually used in the vectorized version.
Florian Hahn [Mon, 17 Jan 2022 13:27:33 +0000 (13:27 +0000)]
[VPlan] Drop unnecessary uses of getVPSingleValue (NFC).
David Sherwood [Mon, 22 Nov 2021 11:38:06 +0000 (11:38 +0000)]
[CodeGen][AArch64] Ensure isSExtCheaperThanZExt returns true for negative constants
When we know the value we're extending is a negative constant then it
makes sense to use SIGN_EXTEND because this may improve code quality in
some cases, particularly when doing a constant splat of an unpacked vector
type. For example, for SVE when splatting the value -1 into all elements
of a vector of type <vscale x 2 x i32> the element type will get promoted
from i32 -> i64. In this case we want the splat value to sign-extend from
(i32 -1) -> (i64 -1), whereas currently it zero-extends from
(i32 -1) -> (i64 0xFFFFFFFF). Sign-extending the constant means we can use
a single mov immediate instruction.
New tests added here:
CodeGen/AArch64/sve-vector-splat.ll
I believe we see some code quality improvements in these existing
tests too:
CodeGen/AArch64/reduce-and.ll
CodeGen/AArch64/unfold-masked-merge-vector-variablemask.ll
The apparent regressions in CodeGen/AArch64/fast-isel-cmp-vec.ll only
occur because the test disables codegen prepare and branch folding.
Differential Revision: https://reviews.llvm.org/D114357
David Green [Mon, 17 Jan 2022 11:04:14 +0000 (11:04 +0000)]
[AArch64] Add tests for sinking mask And to smaller loads. NFC
Fraser Cormack [Sat, 15 Jan 2022 11:46:30 +0000 (11:46 +0000)]
[RISCV] Add tests for scalable-vector vwsub patterns
This patch adds tests for patterns introduced in D117188.
Reviewed By: jacquesguan
Differential Revision: https://reviews.llvm.org/D117392
Nathan James [Mon, 17 Jan 2022 10:55:35 +0000 (10:55 +0000)]
[clangd] Add option to use dirty file contents when building preambles.
Adds a option `use-dirty-preambles` to enable using unsaved in editor contents when building pre-ambles.
This enables a more seamless user experience when switching between header and implementation files and forgetting to save inbetween.
It's also in line with the LSP spec that states open files in the editor should be used instead of on the contents on disk - https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/
For now the option is defaulted to off and hidden, Though I have a feeling it should be moved into the `.clangd` config and possibly defaulted to true.
Addresses https://github.com/clangd/clangd/issues/488
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D95046
Lorenzo Chelini [Thu, 13 Jan 2022 07:43:29 +0000 (08:43 +0100)]
[MLIR][Linalg] Handle Attribute in InitTensorOp
In some cases, the result of an initTensorOp may have an attribute.
However, the Attribute was not passed to `inferResultType`, failing the
verifier. Therefore, propagate the Attribute to `inferResultType`.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D117192
Haojian Wu [Fri, 14 Jan 2022 10:28:04 +0000 (11:28 +0100)]
Reland (2) "[AST] Add RParen loc for decltype AutoTypeloc.""
The patch was reverted because it caused a crash during PCH build -- we
missed to update the RParenLoc in TreeTransform<Derived>::TransformAutoType.
This relands 55d96ac and 37ec65e with a test and fix.
Alex Zinenko [Mon, 17 Jan 2022 09:55:36 +0000 (10:55 +0100)]
Revert "[mlir] fix crash in PybindAdaptors.h"
This reverts commit
970cb57ef72c9045250e0492cb00127b49ddfea8.
Broke the buildbot.
Nikita Popov [Mon, 10 Jan 2022 15:11:24 +0000 (16:11 +0100)]
[MachineInstr] Don't include debug uses in bundle header (PR52817)
Following the recommendation in
https://github.com/llvm/llvm-project/issues/52817#issuecomment-
1007635426,
this excludes debug instructions when finalizing the bundle. As uses
in debug instructions don't have effects, they will no longer be
included in the BUNDLE header.
Fixes https://github.com/llvm/llvm-project/issues/52817.
Differential Revision: https://reviews.llvm.org/D116945
Haojian Wu [Mon, 17 Jan 2022 09:35:29 +0000 (10:35 +0100)]
[clangd] Avoid a code completion crash
This is a workaround (adding a newline to the eof) in clangd to avoid the code
completion crash, see https://github.com/clangd/clangd/issues/332.
In principle, this is a clang bug, we should fix it in clang, but it is not
trivial.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D117456
Ralf Grosse-Kunstleve [Tue, 11 Jan 2022 18:34:38 +0000 (19:34 +0100)]
[LLDB] Fix Python GIL-not-held issues
The GIL must be held when calling any Python C API functions. In multithreaded applications that use callbacks this requirement can easily be violated by accident. A general tool to ensure GIL health is not available, but patching Python Py_INCREF to add an assert provides a basic health check:
```
+int PyGILState_Check(void); /* Include/internal/pystate.h */
+
#define Py_INCREF(op) ( \
+ assert(PyGILState_Check()), \
_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
((PyObject *)(op))->ob_refcnt++)
#define Py_DECREF(op) \
do { \
+ assert(PyGILState_Check()); \
PyObject *_py_decref_tmp = (PyObject *)(op); \
if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
--(_py_decref_tmp)->ob_refcnt != 0) \
```
Adding this assertion causes around 50 test failures in LLDB. Adjusting the scope of things guarded by `py_lock` fixes them.
More background: https://docs.python.org/3/glossary.html#term-global-interpreter-lock
Patch by Ralf Grosse-Kunstleve
Differential Revision: https://reviews.llvm.org/D114722
Nikita Popov [Mon, 17 Jan 2022 09:00:54 +0000 (10:00 +0100)]
[ValueTracking] Remove ComputeMultiple() function
This function is no longer used since
499f1ca79f232faae09b1793a994d1a22ba403cd.
Alex Zinenko [Fri, 14 Jan 2022 16:25:41 +0000 (17:25 +0100)]
[mlir] fix crash in PybindAdaptors.h
The constructor function was being defined without indicating its "__init__"
name, which made it interpret it as a regular fuction rather than a
constructor. When overload resolution failed, Pybind would attempt to print the
arguments actually passed to the function, including "self", which is not
initialized since the constructor couldn't be called. This would result in
"__repr__" being called with "self" referencing an uninitialized MLIR C API
object, which in turn would cause undefined behavior when attempting to print
in C++.
Fix this by specifying the correct name.
This in turn uncovers the fact the the mechanism used by PybindAdaptors.h to
bind constructors directly as "__init__" functions taking "self" is deprecated
by Pybind. The modern method requires using "py::init", which seems to rely on
the C++ equivalent of the bound class to be available, which is not the case in
PybindAdaptors.h. A deeper inspection shows that the deprecation concerns
old-style pybind11 constructors that had to allocate the object using
placement new with "self" as memory. The PybindAdaptors.h only provides
extension classes and never allocates (the object construction is delegated to
the base class), so it does not use the deprecated functionality. Use the
implementation detail tag class to convince pybind11 that we are using the
modern constructor binding method and suppress the warning.
On top of that, the definition of the function was incorrectly indicated as the
method on the "None" object instead of being the method of its parent class.
This would result in a second problem when Pybind would attempt to print
warnings pointing to the parent class since the "None" does not have a
"__name__" field or its C API equivalent.
Fix this by specifying the correct parent class by looking it up by name in the
parent module.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D117325
Lian Wang [Mon, 17 Jan 2022 08:58:49 +0000 (08:58 +0000)]
[RISCV] Add scheduler for bfp instruction in Zbf extension
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117290
Nikita Popov [Mon, 17 Jan 2022 09:09:44 +0000 (10:09 +0100)]
[GlobalOpt] Drop an incorrect check
This was a last-minute addition to D117249, and of course I ended
up inverting the condition in a way that caused an uninitialized
memory read.
I've dropped it entirely, as I don't think we actually care whether
the size is zero or not here. The previous code wasn't checking
this either.
Nikita Popov [Tue, 11 Jan 2022 13:24:49 +0000 (14:24 +0100)]
[GlobalOpt] Use generic type when converting malloc to global
The malloc to global transform currently determines the type of the
global by looking at bitcasts of the malloc. This is limited (the
transform fails if there are multiple different types) and
incompatible with opaque pointers.
My initial approach was to construct an appropriate struct type
based on usage in loads/stores. What this patch does instead is
to always create an [i8 x AllocSize] global, without trying to
guess types at all.
This does mean that other transforms that require a certain global
type may break. I fixed two of these in D117034 and D117223, which
I believe should be sufficient to avoid regressions. In particular,
the global SRA change should end up splitting the global into
naturally-typed sub-globals, at which point all other optimizations
should work.
Differential Revision: https://reviews.llvm.org/D117092
Sam McCall [Sun, 16 Jan 2022 15:00:25 +0000 (16:00 +0100)]
[docs] Clarify & update JSONCompilationDatabase docs
- prefer `arguments` over `command`, and add example
- clarify that there's no shell-unescaping of `arguments`
Fixes https://github.com/llvm/llvm-project/issues/53143
Differential Revision: https://reviews.llvm.org/D117428
Fangrui Song [Mon, 17 Jan 2022 08:34:42 +0000 (00:34 -0800)]
[ELF] GnuHashTableSection: replace stable_sort with 2-key sort. NFC
strTabOffset stabilizes llvm::sort. My x86-64 executable is 5+KiB smaller.
Nikita Popov [Thu, 13 Jan 2022 11:39:43 +0000 (12:39 +0100)]
[GlobalOpt] Make global SRA offset based
Currently global SRA uses the GEP structure to determine how to
split the global. This patch instead analyses the loads and stores
that are performed on the global, and collects which types are used
at which offset, and then splits the global according to those.
This is both more general, and works fine with opaque pointers.
This is also closer to how ordinary SROA is performed.
Differential Revision: https://reviews.llvm.org/D117223
Haojian Wu [Mon, 17 Jan 2022 08:17:55 +0000 (09:17 +0100)]
[clangd] Better handling `\n` in the synthesized diagnostic message.
The newline-eof fix was rendered as "insert '...'", this patch
special-case it.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D117294
Nikita Popov [Tue, 11 Jan 2022 11:34:11 +0000 (12:34 +0100)]
[DSE] Remove alloc function check in canSkipDef()
canSkipDef() currently skips inaccessiblememonly calls, but not
if they are allocation functions. This check was added in D103009,
but actually seems to be a leftover from a previous implementation
in D101440. canSkipDef() is not used on the storeIsNoop() path,
where the relevant transform ended up being implemented.
Differential Revision: https://reviews.llvm.org/D117005
Carl Ritson [Mon, 17 Jan 2022 08:04:28 +0000 (17:04 +0900)]
CycleInfo: Fix trivial typo. NFC.
Fangrui Song [Mon, 17 Jan 2022 08:05:27 +0000 (00:05 -0800)]
[ELF] RelocationScanner::scanOne: replace rel.r_offset with offset. NFC
Cameron Mulhern [Mon, 17 Jan 2022 07:54:51 +0000 (08:54 +0100)]
[clang-format] Add a BlockIndent option to AlignAfterOpenBracket
This style is similar to AlwaysBreak, but places closing brackets on new lines.
For example, if you have a multiline parameter list, clang-format currently only supports breaking per-parameter, but places the closing bracket on the line of the last parameter.
Function(
param1,
param2,
param3);
A style supported by other code styling tools (e.g. rustfmt) is to allow the closing brackets to be placed on their own line, aiding the user in being able to quickly infer the bounds of the block of code.
Function(
param1,
param2,
param3
);
For prior work on a similar feature, see: https://reviews.llvm.org/D33029.
Note: This currently only supports block indentation for closing parentheses.
Differential Revision: https://reviews.llvm.org/D109557
Fangrui Song [Mon, 17 Jan 2022 08:02:47 +0000 (00:02 -0800)]
[ELF] Relocations: remove some cast<Undefined>. NFC
Fangrui Song [Mon, 17 Jan 2022 07:56:24 +0000 (23:56 -0800)]
[ELF] De-template getAlternativeSpelling. NFC
Kito Cheng [Sun, 9 Jan 2022 14:16:05 +0000 (22:16 +0800)]
[RISCV] Add initial support for getRegUsageForType and getNumberOfRegisters
Those two TTI hooks are used during vectorization for calculating
register pressure, the default implementation isn't consider for LMUL,
and that's also definitly wrong value for register number (all register class
are 8 registers).
So in this patch we tried to:
1. Calculate right register usage for vector type and scalar type.
2. Return right number of register for general purpose register and
vector register.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116890
Qiu Chaofan [Mon, 17 Jan 2022 07:12:33 +0000 (15:12 +0800)]
[PowerPC] Allow -mfloat128 option for VSX targets
Targets with VSX feature but without native float128 instructions can
also use that type with supplementary libcalls. We don't enable it by
default now because Glibc assumes long double and float128 can be
implicitly converted in between, which is not available under default
'ibmlongdouble' semantics in clang.
This commit partly relands cbd93ce.
Fangrui Song [Mon, 17 Jan 2022 06:51:57 +0000 (22:51 -0800)]
[ELF] Remove unneeded SyntheticSection memset(*, 0, *)
After the D33630 fallout was properly fixed by
a4c5db30be4e216834b44e31b47304ea1b92635f.
Tested by D37462/D44986 tests, the new --no-rosegment test in build-id.s, and a few --rosegment/--no-rosegment programs.
Fangrui Song [Mon, 17 Jan 2022 06:37:31 +0000 (22:37 -0800)]
[ELF] Remove redundant fillTrap and memset(*, 0, *). NFC
The new tests in build-id.s would catch problems if we made a mistake here.
Fangrui Song [Mon, 17 Jan 2022 06:36:22 +0000 (22:36 -0800)]
[ELF][test] Add --build-id tests for -z separate-loadable-segments and --no-rosegment
Fangrui Song [Mon, 17 Jan 2022 05:44:19 +0000 (21:44 -0800)]
[ELF] RelocationSection<ELFT>::writeTo: use unstable partition
esmeyi [Mon, 17 Jan 2022 05:28:25 +0000 (00:28 -0500)]
Reland https://reviews.llvm.org/D113825 after fixing the test expectations.
Fangrui Song [Mon, 17 Jan 2022 05:19:01 +0000 (21:19 -0800)]
[ELF] Change some DenseMap<StringRef, *> to DenseMap<CachedHashStringRef, *>. NFC
Fangrui Song [Mon, 17 Jan 2022 05:02:05 +0000 (21:02 -0800)]
[ELF] StringTableSection: Use DenseMap<CachedHashStringRef> to avoid redundant hash computation
5~6% speedup when linking clang and chrome.
Fangrui Song [Mon, 17 Jan 2022 03:44:48 +0000 (19:44 -0800)]
[Driver][FreeBSD] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D117388
John Ericson [Sun, 16 Jan 2022 06:19:45 +0000 (06:19 +0000)]
[compiler-rt][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/D117420
eopXD [Sat, 15 Jan 2022 20:12:22 +0000 (12:12 -0800)]
[RISCV] Add patterns for vector widening integer multiply-add instructions
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117404