Commit Graph

438348 Commits

Author SHA1 Message Date
Carlos Galvez 1ae33bf426 [clang-tidy] Add cppcoreguidelines-avoid-do-while check
Implements rule ES.75 of C++ Core Guidelines.

Differential Revision: https://reviews.llvm.org/D132461
2022-10-10 07:29:17 +00:00
Valentin Clement 0cf70a33f2
[flang] Allow conversion from boxed derived type to fir.class
This patch updates the fir.convert operation's verifier to allow
conversion from !fir.box<!fir.type<T>> to !fir.class<!fir.type<T>>.

Other conversion involving fir.class are likely needed but will
be added when lowering needs them.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D135445
2022-10-10 08:59:09 +02:00
LiaoChunyu a835b92e6c [RISCV] Use hasAllWUsers to recover XORI/ORI
reference 0fbe71e91f.

Also add testcase for addi.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D135538
2022-10-10 14:16:50 +08:00
Lang Hames 158ad803ee [examples] Fix deprecated use of llvm::empty. 2022-10-09 22:00:43 -07:00
Lang Hames d6c9b3cc34 [ORC] Relax assertions in SimpleRemoteEPCTransport.
Null source/destination pointers are ok for zero-sized messages.
2022-10-09 21:58:10 -07:00
Lang Hames aedeb8d557 [LLJIT] Default to EPCEHFrameRegistrar rather than InProcessEHFrameRegistrar.
Now that ExecutionSession objects alway have ExecutorProcessControl (EPC)
objects attached we can use EPCEHFrameRegistrar by default, rather than
InProcessEHFrameRegistrar. This allows LLJIT to work out-of-the-box with remote
EPCs on platforms that use JITLink, without requiring a custom
ObjectLinkingLayerCreator to override the eh-frame registrar.
2022-10-09 21:58:10 -07:00
Craig Topper 6b24bdb4a5 [RISCV] Remove some vsetvli intrinsics under Zve32*.
Zve32* does not support SEW=64. Or any LMUL smaller than 32/SEW.

Reviewed By: eopXD

Differential Revision: https://reviews.llvm.org/D135519
2022-10-09 20:40:38 -07:00
Kai Luo 50312ea133 [tsan][go] Fix string equal operator
Fixed error
```
compiler-rt/lib/tsan/go/buildgo.sh: 62: [: unexpected operator
```

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D135537
2022-10-10 09:39:23 +08:00
Mehdi Amini 0666e50e14 Apply clang-tidy fixes for modernize-use-equals-default in Bufferize.cpp (NFC) 2022-10-10 01:08:27 +00:00
Mehdi Amini 92f26d4abc Apply clang-tidy fixes for readability-identifier-naming in TosaToLinalg.cpp (NFC) 2022-10-10 01:08:27 +00:00
Mingming Liu 159fb378f7 [AArch64] Swap 'lsl(val1,small-shmt)' to right hand side for AND(lsl(val1,small-shmt), lsl(val2,large-shmt))
On many aarch64 processors (Cortex A78, Neoverse N1/N2/V1, etc), ADD with LSL shift (shift-amount <= 4) has smaller latency and higher
throughput than ADD with larger shift (shift-amunt > 4). This is at least no-op for the rest of the processors.

Differential Revision: https://reviews.llvm.org/D135208
2022-10-09 17:26:54 -07:00
Mingming Liu 4a377653c2 [AArch64][NFC] Precommit test case to show sub-optimal codegen for add(lsl(val1,small-shift), lsl(val2,large-shift)).
Ideally, add operand with smaller shift should be RHS. In that way, smaller-shift is folded into ADD.
- Also add another test case when 'lsl(val1,small-shift)' has one than one use, to show the (planned) optimization won't regress this case.
2022-10-09 17:26:54 -07:00
Florian Hahn fee8f561bd
[ConstraintElimination] Include index type scale.
The current decomposition for GEPs did not correctly handle cases where
GEPs access different source types. Adjust the constraints by including
the indexed type-size as coefficients.

Further generalization to allow GEPs with more than one index is a
needed general follow-up improvement.
2022-10-09 21:53:30 +01:00
Florian Hahn a40fdef734
[ConstraintElimination] Add tests for GEPs with different source types. 2022-10-09 21:51:47 +01:00
luxufan 4de58eb432 [DSE][NFC] Add nounwind attribute to match test intent
Differential Revision: https://reviews.llvm.org/D135533
2022-10-06 04:55:15 +00:00
luxufan eaf6e2fc33 [DSE] Relax constraint on isGuaranteedLoopInvariant
If the location ptr to be killed is in no loop and the Function does not
have irreducible loops, then we can regard it as loop invariant.

Differential Revision: https://reviews.llvm.org/D135369
2022-10-06 03:01:21 +00:00
Yeting Kuo 7329dc0cc3 [RISCV][NFC] Fix unused variable warning.
Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D135365
2022-10-09 21:39:30 +08:00
mydeveloperday 69e772768e [clang-format] Add support to remove unnecessary semicolons after function definition
Fixes: https://github.com/llvm/llvm-project/issues/58217

This change is to remove extraneous and unnecessary ';' from after a function definition, its off by default and carries the same "code modification" warning as some of our other code manipulating changes.

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D135466
2022-10-09 11:18:16 +01:00
Tom Praschan ac21938fbd [clangd] Fix rename for symbol introduced by UsingDecl
Fixes https://github.com/clangd/clangd/issues/170

This patch actually consists of 2 fixes:

1) Add handling for UsingShadowDecl to canonicalRenameDecl().
   This fixes the issue described in https://github.com/clangd/clangd/issues/170.

2) Avoid the "there are multiple symbols under the cursor error" by applying similar
   logic as in https://reviews.llvm.org/D133664.
   This also partly fixes https://github.com/clangd/clangd/issues/586.

Differential Revision: https://reviews.llvm.org/D135489
2022-10-09 14:16:12 +02:00
gonglingqin 5593d36356 [LoongArch] Expand fptrunc store from f64 to f32
Differential Revision: https://reviews.llvm.org/D135510
2022-10-09 17:55:42 +08:00
Florian Hahn 11a6e64ba7
[ConstraintElim] Move logic to get constraint for solving to helper.
Move common logic shared by callers of getConstraint that use the result
to query the constraint system to a new helper getConstraintForSolving.

This includes common legality checks (i.e. not an equality constraint,
no new variables) and the logic to query the unsigned system if possible
for signed predicates.
2022-10-09 10:44:36 +01:00
LLVM GN Syncbot da064c956b [gn build] Port a2c6a1193f 2022-10-09 07:11:39 +00:00
Hui Xie a2c6a1193f [libc++][ranges]implement `std::views::take_while`
Differential Revision: https://reviews.llvm.org/D134952
2022-10-09 08:10:19 +01:00
Chuanqi Xu b72a364bb5 [C++20] [Coroutines] Exit early if we found co_await appears in
unevaluated context

Closes https://github.com/llvm/llvm-project/issues/58133

The direct cause for this issue is that the compilation process
continues after it found it is in a invalid state. [expr.await]p2 says
clearly that the co_await expressions are not allowed to appear in
unevaluated context. So we can exit early in this case. It also reduces
many redundant diagnostic messages (Such as 'expression with side
effects has no effect in an unevaluated context').
2022-10-09 14:59:27 +08:00
Ting Wang bc5e969ca1 [PowerPC] Add vector pair calling convention for AIX
This is AIX part of update after https://reviews.llvm.org/D117225

Fixed the issue that AIX64 with vector pair enabled saw redundant
spill/reload of callee saved vector registers.

Based on original patch by: Kai Luo

Reviewed By: lkail

Differential Revision: https://reviews.llvm.org/D133466
2022-10-09 01:23:18 -04:00
WANG Xuerui 31327c29fb [LoongArch] Don't merge FrameIndex accesses into [F]{LD,ST}X
Otherwise eliminateFrameIndex cannot figure out how to fixup the stack
offset with its stateless logic, because there wouldn't be an immediate
slot for it to trivially write to, and it may not be easy to transform
the surrounding code to make it work.

This fixes a fairly common crash when compiling moderately complex code with
Clang.

Differential Revision: https://reviews.llvm.org/D135251
2022-10-09 13:04:21 +08:00
Keith Smiley f204229e45
[lld-macho] Implement -ignore_auto_link
This option is really only useful for things like debugging
https://github.com/llvm/llvm-project/issues/56939, but there are some
actual uses of it in Swift's build system as well.

Differential Revision: https://reviews.llvm.org/D135528
2022-10-08 21:55:44 -07:00
Petr Hosek 826693e2b0 [CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI
When in-tree libcxx is selected as the sanitizer C++ ABI, use
libcxx-abi-* targets rather than libcxxabi and libunwind directly.

Differential Revision: https://reviews.llvm.org/D134855
2022-10-09 03:35:59 +00:00
Craig Topper fc1f631f85 Remove myself as X86 Backend owner. 2022-10-08 18:39:45 -07:00
Craig Topper b0c2f90453 [RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content. 2022-10-08 18:30:40 -07:00
Phoebe Wang 313c93a344 Add myself to CREDITS.TXT + CODE_OWNERS.TXT
See https://discourse.llvm.org/t/proposed-change-to-x86-code-ownership/65620
2022-10-09 09:02:20 +08:00
Tatsuyuki Ishi 5699692dfc [Support] Add fast path for StringRef::find with needle of length 2.
InclusionRewriter on Windows (CRLF line endings) will exercise this in a
hot path. Calling memcmp repeatedly would be highly suboptimal for that
use case, so give it a specialized path.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D133660
2022-10-09 00:58:07 +00:00
Anton Bikineev 7b85e76500 [PGO] Consider parent context when weighing branches with likelyhood.
Generally, with PGO enabled the C++20 likelyhood attributes shall be
dropped assuming the profile has a good coverage. However, currently
this is not the case for the following code:

 if (always_false()) [[likely]] {
   ...
 }

The patch fixes this and drops the attribute, if the parent context was
executed in the profile. The patch still preserves the attribute, if the
parent context was not executed, e.g. to support the cases when the
profile has insufficient coverage.

Differential Revision: https://reviews.llvm.org/D134456
2022-10-08 23:49:27 +02:00
Simon Pilgrim 3a44435771 Add myself to CREDITS.TXT + CODE_OWNERS.TXT
Phoebe Wang and I are replacing Craig Topper as X86 Code Owners: https://discourse.llvm.org/t/proposed-change-to-x86-code-ownership/65620
2022-10-08 22:19:50 +01:00
Florian Hahn 1ae405144d
[ConstraintElimination] Add tests for chained GEPs without inbounds. 2022-10-08 19:39:37 +01:00
Mehdi Amini a76bd4f59d Apply clang-tidy fixes for llvm-else-after-return in TosaToLinalg.cpp (NFC) 2022-10-08 18:18:13 +00:00
Mehdi Amini 30c7c42341 Apply clang-tidy fixes for performance-unnecessary-value-param in IRCore.cpp (NFC) 2022-10-08 18:18:13 +00:00
Fangrui Song 4fbe33593c [LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
See the updated linkonce_resolution_comdat.ll. For a local linkage GV in a
non-prevailing COMDAT, it remains defined while its leader has been made
available_externally. This violates the COMDAT rule that its members must be
retained or discarded as a unit.

To fix this, update the regular LTO change D34803 to track local linkage
GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)

Fix https://github.com/llvm/llvm-project/issues/58215:
as a size optimization, we place private `__profd_` in a COMDAT with a
`__profc_` key. When FuncImport.cpp makes `__profc_` available_externally due to
a non-prevailing COMDAT, `__profd_` incorrectly remains private. This change
makes the `__profd_` available_externally.

```
cat > c.h <<'eof'
extern void bar();
inline __attribute__((noinline)) void foo() {}
eof
cat > m1.cc <<'eof'
#include "c.h"
int main() {
  bar();
  foo();
}
eof
cat > m2.cc <<'eof'
#include "c.h"
__attribute__((noinline)) void bar() {
  foo();
}
eof

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
# one _Z3foov

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto=thin -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
# one _Z3foov
```

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D135427
2022-10-08 11:09:43 -07:00
Craig Topper 39532ea073 [RISCV] Add signext attribute to i32 arguments in some tests. NFC 2022-10-08 10:50:16 -07:00
Sam McCall 2bb34cc462 [clangd] FindTarget: UsingEnumDecl is not an alias
Unlike UsingDecl it doesn't name the UsingShadowDecls it emits, so it doesn't
make sense to consider them the same thing. Don't consider the UsingEnumDecl
a target when the UsingShadowDecl is referenced.

Differential Revision: https://reviews.llvm.org/D135506
2022-10-08 19:29:35 +02:00
Florian Hahn e0136a62cc
[ConstraintElimination] Support chained GEPs with constant offsets.
Handle the (gep (gep ....), C) case by incrementing the constant
coefficient of the inner GEP, if C is a constant.
2022-10-08 16:59:27 +01:00
Florian Hahn 73950f26f5
[LV] Replace check with assert for reduction resume values (NFC).
At this point, we need to have resume values for all inductions. If not,
this would result in silent mis-compiles.
2022-10-08 16:26:10 +01:00
Florian Hahn be858bda69
[ConstraintElimination] Remove unused function (NFC). 2022-10-08 16:05:56 +01:00
Sanjay Patel eccb9a77c6 [InstCombine] fold exact sdiv to ashr (2nd try)
The 1st attempt failed to updated the test checks as expected.

Original commit message:

sdiv exact X, (1<<ShAmt) --> ashr exact X, ShAmt (if shl is non-negative)

https://alive2.llvm.org/ce/z/kB6VF7

It would probably be better to use ValueTracking to replace this
and the existing transform above it, but the analysis does not
account for the no-wrap properly, and it's not immediately clear
to me how to fix it.
2022-10-08 10:09:44 -04:00
Sanjay Patel ebda06686f [InstCombine] add test for sdiv with shl; NFC 2022-10-08 10:06:44 -04:00
Sanjay Patel 68d4dbc2c1 Revert "[InstCombine] fold exact sdiv to ashr"
This reverts commit fe15290e0c.
The test checks were not updated as expected.
2022-10-08 10:02:03 -04:00
Sanjay Patel fe15290e0c [InstCombine] fold exact sdiv to ashr
sdiv exact X, (1<<ShAmt) --> ashr exact X, ShAmt (if shl is non-negative)

https://alive2.llvm.org/ce/z/kB6VF7

It would probably be better to use ValueTracking to replace this
and the existing transform above it, but the analysis does not
account for the no-wrap properly, and it's not immediately clear
to me how to fix it.
2022-10-08 09:23:46 -04:00
Mark de Wever e17ec8e9ba [libc++] Make charconv require C++17 or later.
Implementing the paper
P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for
        Integral Types in <charconv> Header

Gives issues in language versions prior to C++17. As suggested in
D131855 disable the code prior to C++17. This removes libc++'s
extension.

Reviewed By: ldionne, #libc_vendors, #libc, philnik

Differential Revision: https://reviews.llvm.org/D133216
2022-10-08 13:50:30 +02:00
Evgeny Shulgin a8fbd1157d [clang-tidy] Ignore concepts in `misc-redundant-expression`
The checker should ignore requirement expressions inside concept
definitions, because redundant expressions still make sense here

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

Reviewed By: njames93, aaron.ballman

Differential Revision: https://reviews.llvm.org/D122078
2022-10-08 10:37:16 +00:00
Florian Hahn 9d31d1c214
[ConstraintElimination] Use logic from 3771310eed for queries only.
The logic added in 3771310eed was placed sub-optimally. Applying the
transform in ::getConstraint meant that it would also impact conditions
that are added to the system by the signed <-> unsigned transfer logic.

This meant we failed to add some signed facts to the signed system. To
make sure we still add as many useful facts to the signed/unsigned
systems, move the logic to the point where we query the system.
2022-10-08 11:03:45 +01:00