dingfei [Mon, 24 Jul 2023 10:21:14 +0000 (18:21 +0800)]
[Sema][ObjC] Invalidate BlockDecl with invalid return expr & its parent BlockExpr
Invalidate BlockDecl with implicit return type, in case any of the return value exprs is invalid.
Propagating the error info up by replacing BlockExpr with a RecoveryExpr.
The idea of this fix is given by @hokein(Haojian Wu)
Fix https://github.com/llvm/llvm-project/issues/63863.
Differential Revision: https://reviews.llvm.org/D155396
pvanhout [Mon, 24 Jul 2023 10:22:26 +0000 (12:22 +0200)]
[test][TableGen] Reenable pattern-parsing.td with reverse_iteration
D155821 should have fixed this.
Nikita Popov [Tue, 4 Jul 2023 11:06:20 +0000 (13:06 +0200)]
[Mips] Fix argument lowering for illegal vector types (PR63608)
The Mips MSA ABI requires that legal vector types are passed in
scalar registers in packed representation. E.g. a type like v16i8
would be passed as two i64 registers.
The implementation attempts to do the same for illegal vectors with
non-power-of-two element counts or non-power-of-two element types.
However, the SDAG argument lowering code doesn't support this, and
it is not easy to extend it to support this (we would have to deal
with situations like passing v7i18 as two i64 values).
This patch instead opts to restrict the special argument lowering
to only vectors with power-of-two elements and round element types.
Everything else is lowered naively, that is by passing each element
in promoted registers.
Fixes https://github.com/llvm/llvm-project/issues/63608.
Differential Revision: https://reviews.llvm.org/D154445
Jay Foad [Mon, 24 Jul 2023 09:57:37 +0000 (10:57 +0100)]
[CodeGen] Add machine verification to some tests
This is to catch errors in an upcoming patch.
Dhruv Chawla [Fri, 21 Jul 2023 14:17:02 +0000 (19:47 +0530)]
[NFC][ValueTracking]: Remove redundant computeKnownBits call for LoadInst in isKnownNonZero
For load instructions, computeKnownBits only checks the range metadata.
This check is already present in isKnownNonZero, so there is no need to
fall through to computeKnownBits.
This change gives a speed improvement of 0.12-0.18%:
https://llvm-compile-time-tracker.com/compare.php?from=
3c6ed559e5274307995586c1499a2c8e4e0276a0&to=
78b462d8c4ae079638b728c6446da5999c4ee9f8&stat=instructions:u
Differential Revision: https://reviews.llvm.org/D155958
Luke Lau [Mon, 24 Jul 2023 09:58:22 +0000 (10:58 +0100)]
[RISCV] Set Fast flag for unaligned memory accesses
The +unaligned-scalar-mem and +unaligned-vector-mem features were added in
D126085 and D149375 respectively to allow subtargets to indicate that
they supported misaligned loads/stores with "sufficient" performance.
This is separate from whether or not the target actually supports
misaligned accesses, which could be determined from Zicclsm.
This patch enables the Fast flag under the assumption that any subtarget
that declares support for +unaligned-*-mem will want to opt into
optimisations that take advantage of misaligned scalar accesses, such as
store merging.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D150771
Tomasz Kamiński [Mon, 24 Jul 2023 09:02:44 +0000 (11:02 +0200)]
[NFC][analyzer] Enable implicit destructor for cfg-lifetime tests
This enables `cfg-temporary-dtors`, `cfg-rich-constructors`, and
`cfg-implicit-dtors` (defaults for CSA) for CFGLifetime test,
making int consistent with `cfg-scopes` test.
Before the fixes implemented in https://reviews.llvm.org/D153273,
this flags were incompatible.
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D155694
WANG Rui [Mon, 24 Jul 2023 09:47:09 +0000 (17:47 +0800)]
[LoongArch] Implement isZextFree
This returns true for 8-bit and 16-bit loads, allowing ld.bu/ld.hu to be selected and avoiding unnecessary masks.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D154819
WANG Rui [Mon, 24 Jul 2023 09:47:08 +0000 (17:47 +0800)]
[LoongArch] Add test case showing suboptimal codegen when loading unsigned char/short
Implementing isZextFree will allow ld.bu or ld.hu to be selected rather than ld.b+mask and ld.h+mask.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D154818
WANG Rui [Mon, 24 Jul 2023 09:35:03 +0000 (17:35 +0800)]
[LoongArch] Implement isLegalICmpImmediate
This causes a trivial improvement in the legalicmpimm.ll test case.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D154811
WANG Rui [Mon, 24 Jul 2023 09:35:02 +0000 (17:35 +0800)]
[LoongArch][NFC] Add tests for (X & -256) == 256 -> (X >> 8) == 1
Add tests for (X & -256) == 256 -> (X >> 8) == 1.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: xen0n
Differential Revision: https://reviews.llvm.org/D154810
Simon Pilgrim [Mon, 24 Jul 2023 09:37:03 +0000 (10:37 +0100)]
[clangd] InlayHints.cpp - fix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Mon, 24 Jul 2023 09:34:40 +0000 (10:34 +0100)]
[include_cleaner] IncludeSpeller.cpp - fix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Mon, 24 Jul 2023 09:33:28 +0000 (10:33 +0100)]
[JITLink] ppc64.h - fix MSVC "not all control paths return a value" warning. NFC.
Alex Bradbury [Mon, 24 Jul 2023 09:36:42 +0000 (10:36 +0100)]
[clang][docs] Attempt to fix warning when building ReleaseNotes
I believe my previous patch,
17a58b3ca7ec18585e9ea8ed8b39d72fe36fb6cb
introduced a warning here.
Alex Bradbury [Mon, 24 Jul 2023 09:22:38 +0000 (10:22 +0100)]
[clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions in C++
As reported in <https://github.com/llvm/llvm-project/issues/58929>,
Clang's handling of empty structs in the case of small structs that may
be eligible to be passed using the hard FP calling convention doesn't
match g++. In general, C++ record fields are never empty unless
[[no_unique_address]] is used, but the RISC-V FP ABI overrides this.
After this patch, fields of structs that contain empty records will be
ignored, even in C++, when considering eligibility for the FP calling
convention ('flattening'). See also the relevant psABI issue
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/358> which
seeks to clarify the documentation.
Fixes https://github.com/llvm/llvm-project/issues/58929
Differential Revision: https://reviews.llvm.org/D142327
WANG Rui [Mon, 24 Jul 2023 09:16:03 +0000 (17:16 +0800)]
[LoongArch] Implement isLegalAddImmediate
This brings a trivial improvement in the and-add-lsr.ll test case.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D154762
WANG Rui [Mon, 24 Jul 2023 09:03:32 +0000 (17:03 +0800)]
[LoongArch] Add tests for (and (add x, c1), (lshr y, c2))
Add tests for (and (add x, c1), (lshr y, c2)).
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D154809
Tomasz Kamiński [Mon, 24 Jul 2023 07:23:01 +0000 (09:23 +0200)]
[analyzer] Fix crash in GenericTaintChecker when propagatig taint to AllocaRegion
The `GenericTaintChecker` checker was crashing, when the taint
was propagated to `AllocaRegion` region in following code:
```
int x;
void* p = alloca(10);
mempcy(p, &x, sizeof(x));
```
This crash was caused by the fact that determining type of
`AllocaRegion` returns a null `QualType`.
This patch makes `AllocaRegion` expose its type as `void`,
making them consistent with results of `malloc` or `new`
that produce `SymRegion` with `void*` symbol.
Reviewed By: steakhal, xazax.hun
Differential Revision: https://reviews.llvm.org/D155847
WANG Rui [Mon, 24 Jul 2023 05:24:07 +0000 (13:24 +0800)]
[DAGCombine] Canonicalize operands for visitANDLike
During the construction of SelectionDAG, there are no explicit canonicalization rules to adjust the order of operands for AND nodes. This may prevent the optimization in DAGCombiner::visitANDLike from being triggered. This patch canonicalizes the operands before matches, which can be observed to improve optimization on the RISC-V target architecture.
Canonicalize:
```
and(x, add) -> and(add, x)
```
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D154760
WANG Rui [Mon, 24 Jul 2023 05:23:57 +0000 (13:23 +0800)]
[RISCV] Add tests for (and (add x, c1), (lshr y, c2))
Add tests for (and (add x, c1), (lshr y, c2)).
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D154808
Sander de Smalen [Mon, 24 Jul 2023 08:04:15 +0000 (08:04 +0000)]
[AArch64][SME] Use `fmov` instead of NEON `movi` for FP value.
NEON `movi` is not valid in Streaming SVE mode, so use an `fmov`
instruction instead for zero-initializing a FP value.
Reviewed By: hassnaa-arm
Differential Revision: https://reviews.llvm.org/D155432
Michael Platings [Mon, 24 Jul 2023 08:35:19 +0000 (09:35 +0100)]
Revert "[NFC] Add checks for self-assignment."
This reverts commit
8ac137acefc01caf636db5f95eb0977c97def1ba.
The code does not compile.
pvanhout [Mon, 24 Jul 2023 08:28:39 +0000 (10:28 +0200)]
[TableGen][GlobalISel] Fix warning when casting to `void *`
Sindhu Chittireddy [Thu, 20 Jul 2023 03:15:47 +0000 (20:15 -0700)]
[NFC] Add checks for self-assignment.
Differential Revision: https://reviews.llvm.org/D155776
Antonio Frighetto [Mon, 24 Jul 2023 07:23:31 +0000 (09:23 +0200)]
[clang][CodeGen] Introduce `-frecord-command-line` for MachO
Allow clang driver command-line recording when
targeting MachO object files as well.
Reviewed-by: sgraenitz
Differential Revision: https://reviews.llvm.org/D155716
pvanhout [Thu, 20 Jul 2023 12:24:12 +0000 (14:24 +0200)]
[TableGen][GlobalISel] Guarantee stable iteration order for stop-after-parse
Builds on top of
6de2735c2428 to fix remaining issues with iteration order in the MatchTable Combiner backend.
See D155789 as well.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155821
Yingwei Zheng [Mon, 24 Jul 2023 07:03:34 +0000 (15:03 +0800)]
[ConstraintElim] Add facts implied by MinMaxIntrinsic
Fixes https://github.com/llvm/llvm-project/issues/63896 and https://github.com/rust-lang/rust/issues/113757.
This patch adds facts implied by llvm.smin/smax/umin/umax intrinsics.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D155412
Piotr Zegar [Sun, 23 Jul 2023 19:22:42 +0000 (19:22 +0000)]
[clang-tidy] Add bugprone-empty-catch check
Detects and suggests addressing issues with empty catch statements.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D144748
Balazs Benics [Mon, 24 Jul 2023 06:26:54 +0000 (08:26 +0200)]
[analyzer][docs] Add CSA release notes
We'll soon branch off, and start releasing clang-17.
Here is a patch, adjusting the release notes for what we achieved since
the last release.
I used this command to inspect the interesting commits:
```
git log --oneline llvmorg-16.0.0..llvm/main \
clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | \
grep -v NFC | grep -v -i revert
```
This filters in CSA directories and filters out NFC and revert commits.
Given that in the release-notes, we usually don't put links to commits,
I'll remove them from this patch as well. I just put them there to make
it easier to review for you.
I tried to group the changes into meaningful chunks, and dropped some of
the uninteresting commits.
I've also dropped the commits that were backported to clang-16.
Check out how it looks, and propose changes like usual.
---
FYI the `ninja docs-clang-html` produces the html docs, including the `ReleaseNotes`.
And the produced artifact will be at `build/tools/clang/docs/html/ReleaseNotes.html`.
Differential Revision: https://reviews.llvm.org/D155445
Craig Topper [Mon, 24 Jul 2023 05:42:36 +0000 (22:42 -0700)]
[RISCV] Add Zicond RUN lines to xaluo.ll. NFC
A couple of these tests show a need for computeKnownBits support
for Zicond.
Kai Luo [Mon, 24 Jul 2023 06:00:20 +0000 (14:00 +0800)]
[JITLink][PowerPC] Correct handling of R_PPC64_REL24_NOTOC
According to the ELFv2 ABI
> This relocation type is used to specify a function call where the TOC pointer is not initialized. It is similar to R_PPC64_REL24 in that it specifies a symbol to be resolved. If the symbol resolves to a function that requires a TOC pointer (as determined by st_other bits) then a link editor must arrange for the call to be via the global entry point of the called function. Any stub code must not rely on a valid TOC base address in r2.
This patch fixes handling of `R_PPC64_REL24_NOTOC` by using the same stub code sequence as lld.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D155672
Yingwei Zheng [Mon, 24 Jul 2023 05:57:00 +0000 (13:57 +0800)]
[ConstraintElim] Add test cases from PR63896. NFC.
This patch adds some test cases from https://github.com/llvm/llvm-project/issues/63896.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D155853
Jim Lin [Mon, 24 Jul 2023 04:29:07 +0000 (12:29 +0800)]
[RISCV] Remove unused check prefixes for tests. NFC
Also remove the warning line for that these prefixes are unused.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D156048
eopXD [Fri, 21 Jul 2023 03:59:34 +0000 (20:59 -0700)]
[RISCV] Support register allocation for GHC when f/d is not specified in the architecture
This patch supports register allocation for floating-point types when
`zfinx` and `zdinx` is specified in the architecture for the GHC
calling convention.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155910
wanglei [Mon, 24 Jul 2023 03:40:29 +0000 (11:40 +0800)]
[LoongArch] Add definition for LVZ/LBT instructions
This patch defines the `LVZ` and `LBT` extension instructions, which
provide enough definitions for llvm-mc and llvm-objdump to correctly
handle these instructions.
It also defines the `SCR` (Scratchpad Register) register class, which
are used by the `LBT` extension instructions.
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D155917
Jacques Pienaar [Mon, 24 Jul 2023 04:40:12 +0000 (21:40 -0700)]
[mlir] Enable converting properties during C create
This enables querying properties passed as attributes during
construction time. In particular needed for type inference where the
Operation has not been created at this point. This allows Python
construction of operations whose type inference depends on properties.
Differential Revision: https://reviews.llvm.org/D156070
esmeyi [Mon, 24 Jul 2023 04:35:24 +0000 (00:35 -0400)]
[XCOFF] Write source language ID and CPU version ID into C_FILE symbol.
Summary: The source language ID and CPU version ID are required by debuggers on AIX. AIX's system assembler determines the source language ID based on the source file's name suffix, and the behavior in this patch is consistent with it.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D155684
Jacques Pienaar [Mon, 24 Jul 2023 04:26:52 +0000 (21:26 -0700)]
[mlir][py] Reuse more of CAPI build time inference.
This reduces code generated for type inference and instead reuses
facilities CAPI side that performed same role.
Differential Revision: https://reviews.llvm.org/D156041t
Pravin Jagtap [Mon, 24 Jul 2023 04:05:42 +0000 (00:05 -0400)]
[AMDGPU] Add llvm.amdgcn.wave.reduce.umin/umax Intrinsic.
When input to intrinsic is uniform value, reduced value is
same as input whereas if input value is divergent we need
to iterate over all active lanes of WaveFront to perform
the reduction.
The control flow for a `loop` has been set up, which
iterates over `only` active lanes to perform reduction.
Introduced WAVE_REDUCE_UMIN_PSEUDO_U32 and
WAVE_REDUCE_UMAX_PSEUDO_U32 Pseudos which
are lowered Post-ISel (in `EmitInstrWithCustomInserter `).
Reviewed By: arsenm, #amdgpu
Differential Revision: https://reviews.llvm.org/D154858
Jim Lin [Mon, 24 Jul 2023 02:33:40 +0000 (10:33 +0800)]
[RISCV] Adjust definition order in RISCVInstrInfoZvk.td to be the same with other td file
The definition order is operand/SDNode, instruction class template,
instruction, pseudo instruciton, codegen patterns, ....
Jie Fu [Mon, 24 Jul 2023 03:33:02 +0000 (11:33 +0800)]
[AArch64][GlobalISel] Remove unused variable 'v2s8' in AArch64LegalizerInfo.cpp (NFC)
/Users/jiefu/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:53:13: error: unused variable 'v2s8' [-Werror,-Wunused-variable]
const LLT v2s8 = LLT::fixed_vector(2, 8);
^
1 error generated.
Shilei Tian [Mon, 24 Jul 2023 03:30:45 +0000 (23:30 -0400)]
Revert commits for kernel environment
This reverts commits for kernel environments as they causes issues in AMD BB.
Zhongyunde [Mon, 24 Jul 2023 03:25:07 +0000 (11:25 +0800)]
[AArch64][GlobalISel] Legalize <2 x s8> and <4 x s8> for G_BUILD_VECTOR
Refer to commit ccffc27, the remaining types <2 x s8> and <4 x s8> should
also be promoted to <2 x s32> and <4 x s16>.
Fixes https://github.com/llvm/llvm-project/issues/58274
Reviewed By: aemerson, tschuett, paquette, dmgreen
Differential Revision: https://reviews.llvm.org/D153394
Farid Zakaria [Mon, 24 Jul 2023 03:19:42 +0000 (20:19 -0700)]
[CMake] Disable GCC -Wnonnull
I noticed during the build that GCC would emit a ton of nonnull
warnings.
Example:
```
/usr/local/google/home/fmzakari/code/github.com/llvm/llvm-project/clang/include/clang/AST/ExternalASTSource.h:378:54: warning: ‘this’ pointer is null [-Wnonnull]
378 | Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1));
| ~~~~~~~~~~~~~~^~~~~~~~~~
```
Reviewed By: MaskRay, rsmith
Differential Revision: https://reviews.llvm.org/D155857
Wu, Yingcong [Mon, 24 Jul 2023 03:12:39 +0000 (20:12 -0700)]
[sanitizer] use the right type for sizeof for interceptor hook
`PRE_READ` is called with a pointer and the size of the object
the pointer points to. But there is one line of code not calling
`PRE_READ` correctly(likely missing a dereference).
This patch fixes the problem.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D154676
Jun Sha (Joshua) [Mon, 24 Jul 2023 02:37:58 +0000 (10:37 +0800)]
[RISCV] Add codegen for Zfbfmin instructions
The implementation in https://reviews.llvm.org/D151313 is done for the circumstance without Zfbfmin. This patch adds codegen support for the 6 instructions provided in Zfbfmin extension.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D153234
Freddy Ye [Mon, 24 Jul 2023 01:30:00 +0000 (01:30 +0000)]
[X86] Remove SHA512 from Graniterapids in backend.
Frontend didn't and this feature.
khei4 [Sat, 22 Jul 2023 05:25:32 +0000 (14:25 +0900)]
Reapply: [MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas""
This reverts commit
c9d419c1df72b0160e374f8d0b9f30508b3b98a7.
Differential Revision: https://reviews.llvm.org/D153453
Shilei Tian [Sun, 23 Jul 2023 22:55:41 +0000 (18:55 -0400)]
[LLVM] Remove the module dump introduced mistakenly
Shilei Tian [Sun, 23 Jul 2023 22:51:02 +0000 (18:51 -0400)]
[MLIR][OpenMP] Remove local_unnamed_addr from check line
Shilei Tian [Sun, 23 Jul 2023 22:45:44 +0000 (18:45 -0400)]
[MLIR][OpenMP] Fix wrong check lines in mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir
Shilei Tian [Sun, 23 Jul 2023 22:35:38 +0000 (18:35 -0400)]
[OpenMP] Introduce kernel environment
This patch introduces per kernel environment. Previously, flags such as execution mode are set through global variables with name like `__kernel_name_exec_mode`. They are accessible on the host by reading the corresponding global variable, but not from the device. Besides, some assumptions, such as no nested parallelism, are not per kernel basis, preventing us applying per kernel optimization in the device runtime.
This is a combination and refinement of patch series D116908, D116909, and D116910.
Depend on D155886.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142569
Fangrui Song [Sun, 23 Jul 2023 22:15:05 +0000 (15:15 -0700)]
[X86] Fix a typo of Broadwell after D74918. NFC
Close #64053
Fangrui Song [Sun, 23 Jul 2023 22:06:33 +0000 (15:06 -0700)]
ReleaseNotes: add lld/ELF notes
Shilei Tian [Sun, 23 Jul 2023 21:40:52 +0000 (17:40 -0400)]
[OpenMP][Plugin] Update the global address calculation
Current global address caculation doesn't work for AMDGPU in some cases (https://reviews.llvm.org/D142569#4506212).
The root cause is the `sh_addr` is not substracted when caculating the address.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D155886
Andrzej Warzynski [Sun, 23 Jul 2023 21:05:47 +0000 (23:05 +0200)]
[mlir][docs][nfc] Fix markdown link
Shivam Gupta [Sun, 23 Jul 2023 18:11:39 +0000 (23:41 +0530)]
[clang-tidy] performance-* checks: Also allow allow member expressions to be used in a const manner.
Until now when determining all the const uses of a VarDecl we only considered
how the variable itself was used. This change extends checking for const usages
of the type's members as well.
This increases the number of true positives for various performance checks that
share the same const usage analysis.
Path by Felix Berger
Reviewed By: njames93, PiotrZSL
Differential Revision: https://reviews.llvm.org/D97567
David Green [Sun, 23 Jul 2023 18:17:11 +0000 (19:17 +0100)]
[AArch64] Lower fcvtl2 (fpext) via tablegen patterns.
This patch does two things. First it removes the tryHighFPExt DAG2DAG method
used to select fcvtl2 instructions, using tablegen patterns through
SelectExtractHigh instead. This essentially undoes D71515, in a way that should
hopefully avoid any regressions. The second is that a GI equivalent of
SelectExtractHigh is added in selectExtractHigh, from G_UNMERGE_VALUES. The
end result is that GlobalISel (and some constrained fpext) can now make use of
the fcvtl2 instructions, saving an extra dup/ext.
Differential Revision: https://reviews.llvm.org/D155871
Piotr Zegar [Sun, 23 Jul 2023 18:12:47 +0000 (18:12 +0000)]
Revert "[clang-tidy] Add bugprone-empty-catch check"
CI failed on "ubuntu-fast" due to disabled exceptions.
This reverts commit
f256fee5343033bf8a31aee06a80f3e982b76f82.
LLVM GN Syncbot [Sun, 23 Jul 2023 18:04:35 +0000 (18:04 +0000)]
[gn build] Port
f256fee53430
Piotr Zegar [Sun, 23 Jul 2023 18:02:03 +0000 (18:02 +0000)]
[clang-tidy] Add bugprone-empty-catch check
Detects and suggests addressing issues with empty catch statements.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D144748
Simon Pilgrim [Sun, 23 Jul 2023 17:41:12 +0000 (18:41 +0100)]
[X86] IsEligibleForTailCallOptimization - use for-range loops where possible. NFCI.
Noah Goldstein [Sun, 23 Jul 2023 16:26:20 +0000 (11:26 -0500)]
[InstCombine] Fix bug in canonicalization of Pow2 Tests (From: D152673)
D152673 Incorrectly didn't account for operand position in the `icmp`,
i.e it treated `icmp uge x, y` the same as `icmp uge y, x` which is
incorrect:
https://reviews.llvm.org/rG142f7448e770f25b774b058a7eab1f107c4daad9
The fix takes operand position into account. The new tests
exhaustively cover all operand positions for `ule`, `uge`, `ult`,
`ugt` (the set of predicates) and all transform verify with the new
commit.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D156058
David Green [Sun, 23 Jul 2023 15:58:13 +0000 (16:58 +0100)]
[AArch64][GISel] Additional FPExt vector lowering
Similar to D155311, this adds lowering for more vector cases for FPExt
Differential Revision: https://reviews.llvm.org/D155601
Maksim Panchenko [Sat, 22 Jul 2023 02:14:26 +0000 (19:14 -0700)]
[BOLT] Fix jump table issue for split functions
A jump table in a split function may contain an entry matching a start
address of another fragment of the function. While converting addresses
to labels, we used to ignore such entries resulting in underpopulated
jump table. Change that, so we always create one label per address.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D156013
Nuno Lopes [Sun, 23 Jul 2023 14:57:21 +0000 (15:57 +0100)]
[LSR] Use poison instead of undef as placeholder [NFC]
This value is patcher afterwards, and only used temporarily during dbg info construction
Simon Pilgrim [Sun, 23 Jul 2023 14:49:22 +0000 (15:49 +0100)]
[X86] getIntImmCostInst - avoid repeating getNumOperands() in for-loop (style). NFC.
Simon Pilgrim [Sun, 23 Jul 2023 14:45:10 +0000 (15:45 +0100)]
[X86] getIntImmCostInst - silence static analyzer overflow warning. NFCI.
Use the divideCeil uint64_t return type directly
Nuno Lopes [Sun, 23 Jul 2023 14:02:23 +0000 (15:02 +0100)]
[Scalarizer] Fold -1 mask in shufflevector to poison instead of undef
Per latest LangRef
Shivam Gupta [Sun, 23 Jul 2023 13:53:32 +0000 (19:23 +0530)]
[clang-tidy][clang-tidy-diff.py] Change shebang from python to python3
Phoebe Wang [Sun, 23 Jul 2023 12:29:54 +0000 (20:29 +0800)]
[X86][FP16] Split v32f16 shuffle when feature BWI is off
Found this problem when investigating #63017
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D156050
Piotr Zegar [Sun, 23 Jul 2023 12:29:18 +0000 (12:29 +0000)]
[clang-tidy][NFC] Fix links to fuchsia codding standard
Correct links to fuchsia codding standard in
documentation for fuchsia-* checks.
Partially fixes: #62334
Simon Pilgrim [Sun, 23 Jul 2023 11:21:39 +0000 (12:21 +0100)]
[X86] lowerRegToMasks - rename masklen -> MaskLenVT. NFC.
Fixes style warning
Antonio Frighetto [Sun, 23 Jul 2023 11:25:14 +0000 (11:25 +0000)]
[InstCombine] Regenerate test checks (NFC)
Antonio Frighetto [Sun, 23 Jul 2023 10:52:47 +0000 (10:52 +0000)]
[InstCombine] Do not assume scalar types in `select`/`zext`
Do not assume scalar types when folding binops of `select`
operations and `zext`/`sext` of their condition.
Reported-by: Benjins, dyung
Proofs: https://alive2.llvm.org/ce/z/GmDLns
Simon Pilgrim [Sun, 23 Jul 2023 10:53:35 +0000 (11:53 +0100)]
[X86] X86ISelLowering.cpp - fix some mixed case SDLoc variable names. NFC.
Consistently use SDLoc DL
Simon Pilgrim [Sun, 23 Jul 2023 10:11:57 +0000 (11:11 +0100)]
Add missing 'namespace X86' closing comment to appease static analyser. NFC.
Simon Pilgrim [Sat, 22 Jul 2023 21:12:49 +0000 (22:12 +0100)]
[X86] LowerFunnelShift - manually expand funnel shifts by splat constant patterns.
Followup to
af32e51a43fb4343f - where the undef funnel shift amounts (during widening from v2i32 -> v4i32) were being constant folded to 0 when the shift amounts are created during expansion, losing the splat'd shift amounts.
Simon Pilgrim [Sat, 22 Jul 2023 17:47:11 +0000 (18:47 +0100)]
[X86] Add basic test coverage for funnels shifts of sub-128-bit vector types
Corentin Jabot [Sun, 23 Jul 2023 09:09:43 +0000 (11:09 +0200)]
[Clang][NFC] Restore changelog entry incorrectly removed by
02bb2beeef
Amirreza Ashouri [Sun, 23 Jul 2023 08:40:48 +0000 (10:40 +0200)]
[clang] Fix diagnostics for defaulted, implicitly deleted 'operator=='.
https://godbolt.org/z/cMKE3o1aG
According to the issue https://github.com/llvm/llvm-project/issues/63960 , compiler falsely complains that no viable `operator<=>` was found while we are actually looking for a `operator==`.
This bug has been fixed through adding a check of the `OverloadedOperatorKind` type's object, `OO`, to see if it is `OO_EqualEqual` in addition to `OO_ExclaimEqual`.
Reviewed By: #clang-language-wg, cor3ntin
Differential Revision: https://reviews.llvm.org/D155714
Timm Bäder [Sat, 22 Jul 2023 11:29:54 +0000 (13:29 +0200)]
[clang][Interp][NFC] Fix two small code style problems
Timm Bäder [Sat, 22 Jul 2023 11:08:55 +0000 (13:08 +0200)]
[clang][Interp][NFC] Fix InterpStack::dump() for empty stacks
Timm Bäder [Sun, 23 Jul 2023 05:21:37 +0000 (07:21 +0200)]
[clang][Interp][NFC] Clean up getOrCreateDummy()
Timm Bäder [Sun, 23 Jul 2023 05:20:19 +0000 (07:20 +0200)]
[clang][Interp][NFC] Use existing local variable
Instead of calling getSubExpr() again.
Kishan Parmar [Sun, 23 Jul 2023 07:54:35 +0000 (13:24 +0530)]
[PowerPC/SPE] powerpcspe load and store instruction has
8-bit offset instead of 16-bit unlike other load/store instructions.
so if stack grows any further than 8-bit, create one emergency slot
for spilling.
Fangrui Song [Sun, 23 Jul 2023 01:30:02 +0000 (18:30 -0700)]
[unittest] Fix HighlighterTest.cpp after D151683
:: is now parsed as tok::coloncolon even in C mode.
Brad Smith [Sun, 23 Jul 2023 00:01:27 +0000 (20:01 -0400)]
[PowerPC] Reorder setMaxAtomicSizeInBitsSupported(). NFC
Reorder setMaxAtomicSizeInBitsSupported() in numerical and more logical order.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155379
Fangrui Song [Sat, 22 Jul 2023 23:50:47 +0000 (16:50 -0700)]
[Support] Change StringMap hash function from xxHash64 to xxh3_64bits
Similar to D142862.
xxh3 is significantly faster than xxh64. Switch to xxh3, as we did for
for lld and llvm-dwarfutil to increase performance (D154813 D155675).
While I think StringMap is not a bottleneck for most applications, it
seems good to eliminate the slower xxh64.
In addition, according to Erik Desjardins, an artificial benchmark of
Rust with very large constant strings improves by ~3% locally.
I have fixed all found issues (~20) separately, but one is remaining:
* ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s has a
failure due to StringMap iteration order. It now passes
with LLVM_ENABLE_REVERSE_ITERATION=on while failing with
LLVM_ENABLE_REVERSE_ITERATION=off.
Reviewed By: erikdesjardins
Differential Revision: https://reviews.llvm.org/D155781
Fangrui Song [Sat, 22 Jul 2023 23:45:32 +0000 (16:45 -0700)]
[gdb-remote] Sort entries in QEnvironment*
Similar to
ae316ac66ffff430997e342772fc4629c1acece0 for
QEMU_(UN)SET_ENV.
The iteration order of StringMap is not guaranteed to be deterministic.
Sort the entries to give deterministic packets for the tests added by
D108018.
Fangrui Song [Sat, 22 Jul 2023 23:06:29 +0000 (16:06 -0700)]
[test] Fix compiler_version.f90 for -DLLVM_APPEND_VC_REV=OFF builds after D152572
Checking the patch version is too strict. Just check major and minor
versions as in clang/test/Driver/immediate-options.c.
Fangrui Song [Sat, 22 Jul 2023 22:57:41 +0000 (15:57 -0700)]
[Frontend] Sort featuresVec for AMDGPU target features
D145579 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.
Amaury Séchet [Wed, 5 Jul 2023 17:45:01 +0000 (17:45 +0000)]
[DAG] Improve carry reconstruction in combineCarryDiamond.
The gain is usually suffiscient to go the extra mile and reconstruct a carry in some cases.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D154533
Fangrui Song [Sat, 22 Jul 2023 22:47:44 +0000 (15:47 -0700)]
[InstrProf] Stabilize --show-prof-sym-list dump order
D118181 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.
Fangrui Song [Sat, 22 Jul 2023 22:29:37 +0000 (15:29 -0700)]
[CodeGen] Stabilize C2/D2 to C1/D1 replacement order
The conversion iterates over CodeGenModule::Replacements (a StringMap)
and replaces C2/D2 and moves C1/D1 (
commit
0196a1d98f8a206259a4b5ce93c21807243af92f in 2013, to make the
output look nicer). The iteration order is not guaranteed to be
deterministic, and may cause destructors.cpp to exhibit different
function orders. Use a MapVector instead.
While here, fix an IWYU issue by adding an explicit include, though
MapVector is already used in CodeGenModule.h.
Jessica Clarke [Sat, 22 Jul 2023 22:01:21 +0000 (23:01 +0100)]
[builtins][Mips] Un-break FreeBSD build of __clear_cache
Commit
674a17e9bbe8 ("MIPS/compiler_rt: use synci to flush icache on
r6") completely removed the OS-specific guards under the guise of "For
pre-r6, we can use cacheflush libc function, which is same on Linux and
FreeBSD." However, the code in question had guards for Linux and
OpenBSD, not Linux and FreeBSD, and FreeBSD does not have a cacheflush
libc function as claimed, so this was neither the statement they
intended to make nor was it sufficient justification for making the code
completely unconditional. Whilst the upcoming FreeBSD 14 release has
dropped support for MIPS, FreeBSD 13 has support for it.
Fix this by only calling cacheflush on the OSes where it was previously
called, and not on other OSes where it either definitely isn't available
(FreeBSD) or is unknown (any other OS than the three mentioned in this
commit).
Nuno Lopes [Sat, 22 Jul 2023 21:41:24 +0000 (22:41 +0100)]
[ObjCARC] Use poison instead of undef as placeholder [NFC]
It's used to specify UB (as ptr argument to store) and to RAUW values when UB occurs.
Nuno Lopes [Sat, 22 Jul 2023 21:38:10 +0000 (22:38 +0100)]
[UnifyLoopExits] Use poison instead of undef as placeholder [NFC]
This pass creates phi nodes where only one of the incoming values is used.
The remaining ones can be poison.
Nuno Lopes [Sat, 22 Jul 2023 21:25:41 +0000 (22:25 +0100)]
[RewriteStatepointsForGC] Use poison instead of undef as placeholder [NFC]
This is used in shufflevectors where the placeholder arg is unused.
It's also used when deleting invariant_start