Commit Graph

438318 Commits

Author SHA1 Message Date
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
Chuanqi Xu 0c4f0bf40d [C++20] [Modules] Only allow redeclarations in partitions if they are in the same module
Closes https://github.com/llvm/llvm-project/issues/58196.

The root cause for the problem is an oversight in
https://reviews.llvm.org/D127624, which allows the redeclarations in
partitions. However, we took a mistake there that we should only allow
it if the redeclarations in the one same module instead of return
directly if either the redeclaration lives in a partition. The original
implementation makes no sense and I believe it was an oversight.
2022-10-08 17:44:04 +08:00
Chuanqi Xu 9974ed8049 [C++20] [Modules] Remove assertion of current module when acting on import
Closes https://github.com/llvm/llvm-project/issues/58199

Previously, when we act on a import statement, we'll assume there is a
module declaration in the current TU if the command line tells us we're
compiling a module unit. This makes since on valid codes. However, for
invalid codes, it is possible. See
https://github.com/llvm/llvm-project/issues/58199 for example.

This patch removes the assertion. And the assertion is a noop and it
should be safe to remove it.
2022-10-08 16:44:51 +08:00
Freddy Ye 566c277c64 [X86] Remove AVX512VP2INTERSECT from Sapphire Rapids.
For more details, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D135509
2022-10-08 14:54:03 +08:00
gonglingqin f4ccb577f8 [LoongArch] Do not assert value type in isFPImmLegal
This patch fixes the failure of llvm/test/CodeGen/Generic/vector.ll and
CodeGen/PowerPC/2007-11-19-VectorSplitting.ll for a LoongArch native build.

Differential Revision: https://reviews.llvm.org/D134798
2022-10-08 14:50:48 +08:00
chenglin.bi 3b276a0dec [ARM64EC][clang-cl] Add arm64EC test; NFC 2022-10-08 14:47:50 +08:00
Sam McCall 79ed24eea3 [clangd] Enable standard library index by default.
Differential Revision: https://reviews.llvm.org/D133968
2022-10-08 06:45:59 +02:00
Manoj Gupta 5e5d21462d BareMetal: detect usr/include/c++/v1 path in sysroot
Currently baremetal driver adds <sysroot>/include/c++/v1
for libc++ headers. However on ChromeOS, all include files
are inside <sysroot>/usr/include. So add
<sysroot>/usr/include/c++/v1 if it exists in baremetal driver.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134478
2022-10-07 21:25:18 -07:00
wanglei 730ee6568c [LoongArch] Set correct encodings for DWARF exception handling
This patch sets correct encodings for DWARF exception handling for
LoongArch.

Differential Revision: https://reviews.llvm.org/D134710
2022-10-08 11:53:48 +08:00
Jessica Paquette 45b9c6b01f [GlobalISel] Add commutative matchers for compares.
This adds:

* `m_c_GICmp`
* `m_c_GFCmp`

These work the same way as the standard matchers, but will also try to commute
the LHS and RHS of a compare to get a match.

E.g.

```
m_c_GICmp(m_Pred(...), m_GAdd(...), m_GSub(...))
```

Can match either of

```
icmp cc (add x, y), (sub a, b)
icmp swapped_cc (sub a, b), (add x, y)
```

Differential Revision: https://reviews.llvm.org/D135415
2022-10-07 20:06:13 -07:00
Enna1 9e80add2cf [memprof] dump memprof profile when receive deadly signals
Currently memprof profile is dumped when program exits (call `FinishAndWrite()` in ~Allocator) or `__memprof_profile_dump` is manually called.
For programs that never exit (e.g. server-side application), it will be useful to dump memprof profile when specific signal is received.
This patch installs a signal handler for deadly signals(SIGSEGV, SIGBUS, SIGABRT, SIGILL, SIGTRAP, SIGFPE) like we do in other sanitizers. In the signal handler `__memprof_profile_dump` is called to dump memprof profile.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D134795
2022-10-08 10:08:23 +08:00
Lei Zhang f0c93fd4ca [mlir][vector] Merge accumulator/result transpose into contract
This commit adds a pattern to merge accumulator and result
`vector.transpose` ops into `vector.contract`. This kind of
pattern can be generated for NCHW convolution vectorization,
where we use transposes to convert the 1-D NCW convolution
into NWC during vectorization. Merging the transpose would
mean we can avoid materialize vector extract/insert for
transposes and it makes further vector level transformations
easier.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D135496
2022-10-08 00:43:45 +00:00
Craig Topper f749b2d9a5 [RISCV] Fix incorrect parenthese placement in comment. NFC 2022-10-07 17:16:38 -07:00
Craig Topper 9f67047cf0 [VP][RISCV] Add vp.smax/smin/umax/umin intrinsics
Differential Revision: https://reviews.llvm.org/D135418
2022-10-07 17:14:31 -07:00
Jeff Bailey aa8ab5b213 [libc] Document which date funcs are needed/done
Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D135501
2022-10-08 00:06:22 +00:00
Kostya Serebryany ec96aea846 [libFuzzer] update the libFuzzer docs to reflect the current state.
[libFuzzer] update the libFuzzer docs to reflect the current state.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D135312
2022-10-07 16:31:06 -07:00
Arthur Eubanks 47b1623b1f [llvm-reduce] Fail verifier less when removing debug metadata
Without this patch, we hit the following a lot:
"llvm.dbg.declare intrinsic requires a !dbg attachment"
"DICompileUnit not listed in llvm.dbg.cu"

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D135492
2022-10-07 16:22:13 -07:00
Michael Jones 7c7f331a00 [libc][nfc] fix comment in clock_gettime
The first line got split because it was too long. Now it's fixed.

Differential Revision: https://reviews.llvm.org/D135498
2022-10-07 16:17:41 -07:00
Krzysztof Parzyszek 09d84e0ad8 [Hexagon] Implement helper to get intrinsic for instruction opcode
There are intrinsics for most scalar instructions and almost all HVX
instructions. What's somewhat painful is that there are two intrinsics
for each HVX instruction: one for 64- and one for 128-byte mode.
Instead of checking the current codegen settings every time, this
function would simply return the right intrinsic.
2022-10-07 15:56:06 -07:00
Amaury Séchet 62ea6c5be7
[DAGCombine] Deduplicate addcarry node using commutativity.
The first two parameters of addcarry are commutative. We may face a situation where both variant are present in the DAG, in which case we benefit from using just one.

Depends on D57302 and D33587

Reviewed By: RKSimon, chfast

Differential Revision: https://reviews.llvm.org/D57317
2022-10-08 00:55:14 +02:00
Jessica Paquette 42cb2f8b12 [GlobalISel] Mark mi_match as nodiscard
Typically when you match something, you want to check the result.

Fix a couple warnings in the AMDGPUPostLegalizerCombiner which appear as a
result of this.

Differential Revision: https://reviews.llvm.org/D135491
2022-10-07 15:47:05 -07:00
Lang Hames 7c57a37c30 [JITLink][aarch64] Fix typo in error message. 2022-10-07 14:56:45 -07:00
Arthur Eubanks f3a928e233 [opt] Don't translate legacy -analysis flag to require<analysis>
Tests relying on this should explicitly use -passes='require<analysis>,foo'.
2022-10-07 14:54:34 -07:00
Maksim Panchenko 978f11c8e8 [BOLT][TEST] Fix section order test
.bss section emitted by llvm-bolt (e.g. with instrumentation) is not a
real BSS section, i.e. it takes space in the output file. Hence the
order with respect to .data is not defined. Remove .bss from the test
and fix the buildbot failure.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D135475
2022-10-07 14:38:49 -07:00
Evgeny Shulgin c585a44651 [Clang] Use C++17 in constant-builtins-fmax.cpp test
Add `-std=c++17` to the test so that buildbot won't fail

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D135486
2022-10-07 21:31:38 +00:00
Pavel Chupin 27ef42bec8 Fix warnings in build done by clang-based compiler
Differential Revision: https://reviews.llvm.org/D135230
2022-10-07 14:12:10 -07:00
Artem Belevich 9a01cca660 Add support for CUDA-11.8 and sm_{87,89,90} GPUs.
Differential Revision: https://reviews.llvm.org/D135306
2022-10-07 13:59:28 -07:00
Artem Belevich f3a2cbcf97 Refactored CUDA version housekeeping to use less boilerplate.
Differential Revision: https://reviews.llvm.org/D135328
2022-10-07 13:59:23 -07:00
Arthur Eubanks c966da35df [opt] Remove legacy -print-dom-info pass
This was specific to `opt` for some reason.
There's already a new pass manager pass `print<domtree>` which does the same.
2022-10-07 13:50:16 -07:00
Florian Hahn 13ac102726
[LoopSimplifyCFG] Invalidate SCEV dispositions.
Clear all dispositions if there are any dead blocks (which will get
removed later) and also clear dispositions for removed instructions.

Clearing all dispositions in case there are dead blocks happens first,
which should avoid traversing SCEV use-lists for invalidating
dispositions for individual values.

Fixes #58179.
2022-10-07 21:35:42 +01:00
Evgeny Shulgin 0edff6faa2 [Clang] Support constexpr builtin fmax
Support constexpr version of __builtin_fmax and its variations.

Reviewed By: jcranmer-intel

Differential Revision: https://reviews.llvm.org/D134369
2022-10-07 20:27:17 +00:00