platform/upstream/llvm.git
21 months ago[clangd] Fix rename for symbol introduced by UsingDecl
Tom Praschan [Fri, 7 Oct 2022 23:24:13 +0000 (01:24 +0200)]
[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

21 months ago[LoongArch] Expand fptrunc store from f64 to f32
gonglingqin [Sun, 9 Oct 2022 09:51:10 +0000 (17:51 +0800)]
[LoongArch] Expand fptrunc store from f64 to f32

Differential Revision: https://reviews.llvm.org/D135510

21 months ago[ConstraintElim] Move logic to get constraint for solving to helper.
Florian Hahn [Sun, 9 Oct 2022 09:44:35 +0000 (10:44 +0100)]
[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.

21 months ago[gn build] Port a2c6a1193f41
LLVM GN Syncbot [Sun, 9 Oct 2022 07:11:39 +0000 (07:11 +0000)]
[gn build] Port a2c6a1193f41

21 months ago[libc++][ranges]implement `std::views::take_while`
Hui Xie [Fri, 30 Sep 2022 12:06:36 +0000 (13:06 +0100)]
[libc++][ranges]implement `std::views::take_while`

Differential Revision: https://reviews.llvm.org/D134952

21 months ago[C++20] [Coroutines] Exit early if we found co_await appears in
Chuanqi Xu [Sun, 9 Oct 2022 06:54:32 +0000 (14:54 +0800)]
[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').

21 months ago[PowerPC] Add vector pair calling convention for AIX
Ting Wang [Sun, 9 Oct 2022 05:23:18 +0000 (01:23 -0400)]
[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

21 months ago[LoongArch] Don't merge FrameIndex accesses into [F]{LD,ST}X
WANG Xuerui [Sun, 9 Oct 2022 04:09:21 +0000 (12:09 +0800)]
[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

21 months ago[lld-macho] Implement -ignore_auto_link
Keith Smiley [Sun, 9 Oct 2022 03:38:00 +0000 (20:38 -0700)]
[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

21 months ago[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI
Petr Hosek [Thu, 29 Sep 2022 07:53:06 +0000 (07:53 +0000)]
[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

21 months agoRemove myself as X86 Backend owner.
Craig Topper [Sun, 9 Oct 2022 01:39:45 +0000 (18:39 -0700)]
Remove myself as X86 Backend owner.

21 months ago[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.
Craig Topper [Sat, 8 Oct 2022 17:49:52 +0000 (10:49 -0700)]
[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.

21 months agoAdd myself to CREDITS.TXT + CODE_OWNERS.TXT
Phoebe Wang [Sun, 9 Oct 2022 00:50:16 +0000 (08:50 +0800)]
Add myself to CREDITS.TXT + CODE_OWNERS.TXT

See https://discourse.llvm.org/t/proposed-change-to-x86-code-ownership/65620

21 months ago[Support] Add fast path for StringRef::find with needle of length 2.
Tatsuyuki Ishi [Sun, 9 Oct 2022 00:58:07 +0000 (00:58 +0000)]
[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

21 months ago[PGO] Consider parent context when weighing branches with likelyhood.
Anton Bikineev [Thu, 22 Sep 2022 14:56:03 +0000 (16:56 +0200)]
[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

21 months agoAdd myself to CREDITS.TXT + CODE_OWNERS.TXT
Simon Pilgrim [Sat, 8 Oct 2022 21:19:50 +0000 (22:19 +0100)]
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

21 months ago[ConstraintElimination] Add tests for chained GEPs without inbounds.
Florian Hahn [Sat, 8 Oct 2022 18:39:36 +0000 (19:39 +0100)]
[ConstraintElimination] Add tests for chained GEPs without inbounds.

21 months agoApply clang-tidy fixes for llvm-else-after-return in TosaToLinalg.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:41:58 +0000 (18:41 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in TosaToLinalg.cpp (NFC)

21 months agoApply clang-tidy fixes for performance-unnecessary-value-param in IRCore.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:21:47 +0000 (18:21 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in IRCore.cpp (NFC)

21 months ago[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
Fangrui Song [Sat, 8 Oct 2022 18:09:42 +0000 (11:09 -0700)]
[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

21 months ago[RISCV] Add signext attribute to i32 arguments in some tests. NFC
Craig Topper [Sat, 8 Oct 2022 17:49:52 +0000 (10:49 -0700)]
[RISCV] Add signext attribute to i32 arguments in some tests. NFC

21 months ago[clangd] FindTarget: UsingEnumDecl is not an alias
Sam McCall [Sat, 8 Oct 2022 02:32:15 +0000 (04:32 +0200)]
[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

21 months ago[ConstraintElimination] Support chained GEPs with constant offsets.
Florian Hahn [Sat, 8 Oct 2022 15:59:27 +0000 (16:59 +0100)]
[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.

21 months ago[LV] Replace check with assert for reduction resume values (NFC).
Florian Hahn [Sat, 8 Oct 2022 15:26:08 +0000 (16:26 +0100)]
[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.

21 months ago[ConstraintElimination] Remove unused function (NFC).
Florian Hahn [Sat, 8 Oct 2022 15:05:55 +0000 (16:05 +0100)]
[ConstraintElimination] Remove unused function (NFC).

21 months ago[InstCombine] fold exact sdiv to ashr (2nd try)
Sanjay Patel [Sat, 8 Oct 2022 14:09:44 +0000 (10:09 -0400)]
[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.

21 months ago[InstCombine] add test for sdiv with shl; NFC
Sanjay Patel [Sat, 8 Oct 2022 14:06:44 +0000 (10:06 -0400)]
[InstCombine] add test for sdiv with shl; NFC

21 months agoRevert "[InstCombine] fold exact sdiv to ashr"
Sanjay Patel [Sat, 8 Oct 2022 14:02:03 +0000 (10:02 -0400)]
Revert "[InstCombine] fold exact sdiv to ashr"

This reverts commit fe15290e0cf5d2bcdefca2e81ef6ff8155a2f7a8.
The test checks were not updated as expected.

21 months ago[InstCombine] fold exact sdiv to ashr
Sanjay Patel [Sat, 8 Oct 2022 13:19:21 +0000 (09:19 -0400)]
[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.

21 months ago[libc++] Make charconv require C++17 or later.
Mark de Wever [Fri, 2 Sep 2022 16:46:59 +0000 (18:46 +0200)]
[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

21 months ago[clang-tidy] Ignore concepts in `misc-redundant-expression`
Evgeny Shulgin [Wed, 14 Sep 2022 20:03:14 +0000 (20:03 +0000)]
[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

21 months ago[ConstraintElimination] Use logic from 3771310eed for queries only.
Florian Hahn [Sat, 8 Oct 2022 10:03:44 +0000 (11:03 +0100)]
[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.

21 months ago[C++20] [Modules] Only allow redeclarations in partitions if they are in the same...
Chuanqi Xu [Sat, 8 Oct 2022 09:05:44 +0000 (17:05 +0800)]
[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.

21 months ago[C++20] [Modules] Remove assertion of current module when acting on import
Chuanqi Xu [Sat, 8 Oct 2022 08:38:19 +0000 (16:38 +0800)]
[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.

21 months ago[X86] Remove AVX512VP2INTERSECT from Sapphire Rapids.
Freddy Ye [Sat, 8 Oct 2022 06:27:06 +0000 (14:27 +0800)]
[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

21 months ago[LoongArch] Do not assert value type in isFPImmLegal
gonglingqin [Sat, 8 Oct 2022 06:33:04 +0000 (14:33 +0800)]
[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

21 months ago[ARM64EC][clang-cl] Add arm64EC test; NFC
chenglin.bi [Sat, 8 Oct 2022 06:47:50 +0000 (14:47 +0800)]
[ARM64EC][clang-cl] Add arm64EC test; NFC

21 months ago[clangd] Enable standard library index by default.
Sam McCall [Thu, 15 Sep 2022 19:54:01 +0000 (21:54 +0200)]
[clangd] Enable standard library index by default.

Differential Revision: https://reviews.llvm.org/D133968

21 months agoBareMetal: detect usr/include/c++/v1 path in sysroot
Manoj Gupta [Thu, 22 Sep 2022 20:53:46 +0000 (13:53 -0700)]
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

21 months ago[LoongArch] Set correct encodings for DWARF exception handling
wanglei [Thu, 6 Oct 2022 12:39:59 +0000 (20:39 +0800)]
[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

21 months ago[GlobalISel] Add commutative matchers for compares.
Jessica Paquette [Fri, 7 Oct 2022 19:19:33 +0000 (12:19 -0700)]
[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

21 months ago[memprof] dump memprof profile when receive deadly signals
Enna1 [Sat, 8 Oct 2022 01:55:40 +0000 (09:55 +0800)]
[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

21 months ago[mlir][vector] Merge accumulator/result transpose into contract
Lei Zhang [Sat, 8 Oct 2022 00:43:27 +0000 (00:43 +0000)]
[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

21 months ago[RISCV] Fix incorrect parenthese placement in comment. NFC
Craig Topper [Sat, 8 Oct 2022 00:16:38 +0000 (17:16 -0700)]
[RISCV] Fix incorrect parenthese placement in comment. NFC

21 months ago[VP][RISCV] Add vp.smax/smin/umax/umin intrinsics
Craig Topper [Fri, 7 Oct 2022 17:26:22 +0000 (10:26 -0700)]
[VP][RISCV] Add vp.smax/smin/umax/umin intrinsics

Differential Revision: https://reviews.llvm.org/D135418

21 months ago[libc] Document which date funcs are needed/done
Jeff Bailey [Sat, 8 Oct 2022 00:03:47 +0000 (00:03 +0000)]
[libc] Document which date funcs are needed/done

Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D135501

21 months ago[libFuzzer] update the libFuzzer docs to reflect the current state.
Kostya Serebryany [Wed, 5 Oct 2022 20:22:13 +0000 (13:22 -0700)]
[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

21 months ago[llvm-reduce] Fail verifier less when removing debug metadata
Arthur Eubanks [Fri, 7 Oct 2022 21:37:23 +0000 (14:37 -0700)]
[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

21 months ago[libc][nfc] fix comment in clock_gettime
Michael Jones [Fri, 7 Oct 2022 23:16:15 +0000 (16:16 -0700)]
[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

21 months ago[Hexagon] Implement helper to get intrinsic for instruction opcode
Krzysztof Parzyszek [Fri, 7 Oct 2022 22:40:27 +0000 (15:40 -0700)]
[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.

21 months ago[DAGCombine] Deduplicate addcarry node using commutativity.
Amaury Séchet [Fri, 7 Oct 2022 22:35:25 +0000 (00:35 +0200)]
[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

21 months ago[GlobalISel] Mark mi_match as nodiscard
Jessica Paquette [Fri, 7 Oct 2022 21:33:51 +0000 (14:33 -0700)]
[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

21 months ago[JITLink][aarch64] Fix typo in error message.
Lang Hames [Fri, 7 Oct 2022 21:56:04 +0000 (14:56 -0700)]
[JITLink][aarch64] Fix typo in error message.

21 months ago[opt] Don't translate legacy -analysis flag to require<analysis>
Arthur Eubanks [Fri, 7 Oct 2022 20:12:59 +0000 (13:12 -0700)]
[opt] Don't translate legacy -analysis flag to require<analysis>

Tests relying on this should explicitly use -passes='require<analysis>,foo'.

21 months ago[BOLT][TEST] Fix section order test
Maksim Panchenko [Fri, 7 Oct 2022 18:55:30 +0000 (11:55 -0700)]
[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

21 months ago[Clang] Use C++17 in constant-builtins-fmax.cpp test
Evgeny Shulgin [Fri, 7 Oct 2022 20:54:39 +0000 (20:54 +0000)]
[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

21 months agoFix warnings in build done by clang-based compiler
Pavel Chupin [Fri, 7 Oct 2022 21:01:20 +0000 (14:01 -0700)]
Fix warnings in build done by clang-based compiler

Differential Revision: https://reviews.llvm.org/D135230

21 months agoAdd support for CUDA-11.8 and sm_{87,89,90} GPUs.
Artem Belevich [Wed, 10 Aug 2022 00:28:30 +0000 (17:28 -0700)]
Add support for CUDA-11.8 and sm_{87,89,90} GPUs.

Differential Revision: https://reviews.llvm.org/D135306

21 months agoRefactored CUDA version housekeeping to use less boilerplate.
Artem Belevich [Wed, 5 Oct 2022 22:20:17 +0000 (15:20 -0700)]
Refactored CUDA version housekeeping to use less boilerplate.

Differential Revision: https://reviews.llvm.org/D135328

21 months ago[opt] Remove legacy -print-dom-info pass
Arthur Eubanks [Fri, 7 Oct 2022 20:49:25 +0000 (13:49 -0700)]
[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.

21 months ago[LoopSimplifyCFG] Invalidate SCEV dispositions.
Florian Hahn [Fri, 7 Oct 2022 20:35:42 +0000 (21:35 +0100)]
[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.

21 months ago[Clang] Support constexpr builtin fmax
Evgeny Shulgin [Wed, 21 Sep 2022 15:52:18 +0000 (15:52 +0000)]
[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

21 months agoAMDGPU: Update SlotIndexes independently of LiveIntervals
Matt Arsenault [Thu, 15 Sep 2022 19:42:17 +0000 (15:42 -0400)]
AMDGPU: Update SlotIndexes independently of LiveIntervals

Apparently StackColoring depends on SlotIndexes, but not
LiveIntervals. If regalloc fast were manually requested, LiveIntervals
would be dropped before SILowerSGPRSpills but not SlotIndexes.

SILowerSGPRSpills preserved SlotIndexes, but only through
LiveIntervals. As a result, SILowerSGPRSpills was incorrectly
reporting it preserved SlotIndexes. Start updating these directly,
instead of depending on LiveIntervals also being available.

21 months agollvm-reduce: Fix another invalid reduction with repeated input phis
Matt Arsenault [Thu, 6 Oct 2022 22:04:25 +0000 (15:04 -0700)]
llvm-reduce: Fix another invalid reduction with repeated input phis

ReduceOperandsSkip had the same issue as ReduceOperands when handling
phis with repeated predecessors.

21 months agollvm-reduce: Fix invalid reduction for phis with repeat inputs
Matt Arsenault [Thu, 6 Oct 2022 18:06:02 +0000 (11:06 -0700)]
llvm-reduce: Fix invalid reduction for phis with repeat inputs

Phis have a quirk where the same predecessor block may appear multiple times
if the same block branches to it multiple ways. All the values need to match,
but this was replacing each operand independently. If an operand can be simplified,
make sure to replace every instance of the incoming block's value.

21 months agollvm-reduce: Use -abort-on-invalid-reduction in a test
Matt Arsenault [Tue, 4 Oct 2022 01:34:51 +0000 (18:34 -0700)]
llvm-reduce: Use -abort-on-invalid-reduction in a test

Also stop using cat

21 months agollvm-reduce: Fix missing C++ mode comments
Matt Arsenault [Wed, 5 Oct 2022 04:09:45 +0000 (21:09 -0700)]
llvm-reduce: Fix missing C++ mode comments

21 months ago[mlir][arith] Expose dedicated API for expanding ceil/floor division
Lei Zhang [Fri, 7 Oct 2022 19:42:08 +0000 (19:42 +0000)]
[mlir][arith] Expose dedicated API for expanding ceil/floor division

This allows more precise control over which patterns to pick to
expand arithmetic ops. Previously ceil/floor division epxansion
is only available together with various min/max op expansion.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D135479

21 months ago[ConstraintElimination] Add test for regression after 3771310eede.
Florian Hahn [Fri, 7 Oct 2022 19:42:15 +0000 (20:42 +0100)]
[ConstraintElimination] Add test for regression after 3771310eede.

21 months agoRecommit "[SCEV] Support clearing Block/LoopDispositions for a single value."
Florian Hahn [Fri, 7 Oct 2022 19:15:44 +0000 (20:15 +0100)]
Recommit "[SCEV] Support clearing Block/LoopDispositions for a single value."

This reverts commit 92f698f01fa0bb8967233a6391ada2d51849fa68.

The updated version of the patch includes handling for non-SCEVable
types. A test case has been added in ec86e9a99bca802.

21 months ago[llvm-reduce] Fix di-metadata pass test failures
Matthew Voss [Fri, 7 Oct 2022 19:00:22 +0000 (12:00 -0700)]
[llvm-reduce] Fix di-metadata pass test failures

We're seeing intermittent failures in upstream bots. See:

https://lab.llvm.org/buildbot/#/builders/139/builds/29185
https://lab.llvm.org/buildbot/#/builders/238/builds/295

This appears to be due to the unstable iteration order of DenseSet.
Since we're trying to reduce a tree, it makes sense to attempt
reductions from the top down.

This also addresses post-review comments from @MatzeB.

Differential Revision: https://reviews.llvm.org/D135473

21 months ago[LoopUnroll] Add test for crash exposed by 9e931439.
Florian Hahn [Fri, 7 Oct 2022 19:02:57 +0000 (20:02 +0100)]
[LoopUnroll] Add test for crash exposed by 9e931439.

21 months ago[opt] Remove -passes=asan-pipeline
Arthur Eubanks [Fri, 7 Oct 2022 18:55:36 +0000 (11:55 -0700)]
[opt] Remove -passes=asan-pipeline

It was obsoleted when the asan pass was changed to just be one module pass.

21 months agoRemove PlaceSafepoints pass
Philip Reames [Thu, 6 Oct 2022 15:40:09 +0000 (08:40 -0700)]
Remove PlaceSafepoints pass

This patch was added way back in the beginning of the work which became the statepoint infrastructure. The idea was that safepoints could be inserted late in the optimization pipeline. This is true if the only concern is garbage collection, but this approach turned out to be incompatible with the requirement to also support deoptimization at safepoints.

In theory, this pass would still be quite useful for an AOT compiled language which wants to support garbage collection, but we have no known users, and haven't for over 5 years. Time to remove unused code. If someone wants to use this, restoring it would not be hard. The immediate motivation for removal is that this is one of the last passes remaining which hasn't been ported to the new pass manager and the (straight forward) work to do so is not justified for unused code.

Differential Revision: https://reviews.llvm.org/D135371

21 months ago[opt] Stop treating alias analysis specially when translating legacy opt syntax
Arthur Eubanks [Fri, 7 Oct 2022 18:49:10 +0000 (11:49 -0700)]
[opt] Stop treating alias analysis specially when translating legacy opt syntax

I've attempted to keep AA tests as close to their original intent as possible.

21 months ago[llvm-profdata] Rename show flag to --show-format
Ellis Hoag [Fri, 7 Oct 2022 17:29:59 +0000 (10:29 -0700)]
[llvm-profdata] Rename show flag to --show-format

In https://reviews.llvm.org/D135127 we created the show flag
`--output-format` which was confusing because it behaved differently
than the same flag in the merge command. So, rename the flag to
`--show-format`. This also allows us to add the `text` option to mean
"normal text output" rather than "text-encoded profiles" like it does
for the merge command.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D135467

21 months ago[BOLT] Testcase to repro dyn reloc bug
Rafael Auler [Fri, 7 Oct 2022 18:26:51 +0000 (11:26 -0700)]
[BOLT] Testcase to repro dyn reloc bug

Add a new testcase that shows a bug in BOLT when writing out
dynamic relocations. This is currently marked as XFAIL as we work on
solving it. This bug happens when the current strategy fails to
recognize that the original dynamic relocation in the input should
reference the original .bolt.org.rodata section instead of the new one
.rodata created by BOLT after moving jump tables. This bug started
happening after 729d29e167a5.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D125941

21 months ago[libc] add printf decimal float conversion
Michael Jones [Tue, 12 Jul 2022 23:35:09 +0000 (16:35 -0700)]
[libc] add printf decimal float conversion

This patch adds support for converting doubles to string in the %f/F
format specifier. It does not yet support long doubles outside of the
double range. This implementation is based on the work of Ulf Adams,
specifically the Ryu Printf algorithm.

See:
Ulf Adams. 2019. Ryū revisited: printf floating point conversion.
Proc. ACM Program. Lang. 3, OOPSLA, Article 169 (October 2019), 23 pages.
https://doi.org/10.1145/3360595

Differential Revision: https://reviews.llvm.org/D131023

21 months ago[BOLT] Change order of new sections
Maksim Panchenko [Wed, 5 Oct 2022 00:12:02 +0000 (17:12 -0700)]
[BOLT] Change order of new sections

While the order of new sections in the output binary was deterministic
in the past (i.e. there was no run-to-run variation), it wasn't always
rational as we used size to define the precedence of allocatable
sections within "code" or "data" groups (probably unintentionally).
Fix that by defining stricter section-ordering rules.

Other than the order of sections, this should be NFC.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D135235

21 months ago[BOLT] Fix writing out unmarked .eh_frame section
Maksim Panchenko [Tue, 4 Oct 2022 01:50:18 +0000 (18:50 -0700)]
[BOLT] Fix writing out unmarked .eh_frame section

When BOLT updates .eh_frame section, it concatenates newly-generated
contents (from CFI directives) with the original .eh_frame that has
relocations applied to it. However, if no new content is generated,
the original .eh_frame has to be left intact. In that case, BOLT was
still writing out the relocatable copy of the original .eh_frame section
to the new segment, even though this copy was never used and was not
even marked in the section header table.

Detect the scenario above and skip allocating extra space for .eh_frame.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D135223

21 months ago[BOLT] Properly set _end symbol
Maksim Panchenko [Mon, 3 Oct 2022 23:01:01 +0000 (16:01 -0700)]
[BOLT] Properly set _end symbol

To properly set the "_end" symbol, we need to track the last allocatable
address. Simply emitting "_end" at the end of some section is not
sufficient since the order of section allocation is unknown during the
emission step.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D135121

21 months ago[BOLT][NFC] Remove text section assertion
Maksim Panchenko [Mon, 3 Oct 2022 23:53:34 +0000 (16:53 -0700)]
[BOLT][NFC] Remove text section assertion

We can emit a binary without a new text section. Hence, the text section
assertion is not needed.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D135120

21 months ago[libc] add strsignal and refactor message mapping
Michael Jones [Wed, 5 Oct 2022 20:27:04 +0000 (13:27 -0700)]
[libc] add strsignal and refactor message mapping

The logic for strsignal and strerror is very similar, so I've moved them
both to use a shared utility (MessageMapper) for the basic
functionality.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135322

21 months ago[clangd] Fix buildbots after d1f13c54f172875d9a14c46c09afb1f22d78cdf8
Kadir Cetinkaya [Fri, 7 Oct 2022 18:05:47 +0000 (20:05 +0200)]
[clangd] Fix buildbots after d1f13c54f172875d9a14c46c09afb1f22d78cdf8

21 months ago[opt] Remove temporary legacy pass name translations
Arthur Eubanks [Fri, 7 Oct 2022 18:04:11 +0000 (11:04 -0700)]
[opt] Remove temporary legacy pass name translations

And update corresponding tests.

21 months ago[libc] add strerror_r function
Michael Jones [Tue, 4 Oct 2022 23:47:24 +0000 (16:47 -0700)]
[libc] add strerror_r function

I've implemente the gnu variant of strerror_r since that seems to be the
one more relevant to what we're trying to do.

Differential Revision: https://reviews.llvm.org/D135227

21 months ago[Docs] [HLSL] Add note about PCH support
Xiang Li [Wed, 5 Oct 2022 16:26:25 +0000 (09:26 -0700)]
[Docs] [HLSL] Add note about PCH support

PCH supported for HLSL is added when compile in -cc1 mode using -include-pch for test AST.
This change add some notes about the support of PCH for HLSL.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D134330

21 months ago[NFC] Remove trailing white space in openmp/libomptarget/src/CMakeLists.txt
Shilei Tian [Fri, 7 Oct 2022 17:42:31 +0000 (13:42 -0400)]
[NFC] Remove trailing white space in openmp/libomptarget/src/CMakeLists.txt

21 months ago[Clang][OpenMP] Add one missing form of atomic compare capture
Shilei Tian [Fri, 7 Oct 2022 17:30:31 +0000 (13:30 -0400)]
[Clang][OpenMP] Add one missing form of atomic compare capture

Two another atomic compare capture forms, `{ v = x; expr-stmt }` and `{ expr-stmt; v = x; }`
where `expr-stmt` could be `cond-expr-stmt` are missing.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D135236

21 months ago[InstCombine] propagate 'exact' when converting ashr to lshr
Sanjay Patel [Fri, 7 Oct 2022 17:05:39 +0000 (13:05 -0400)]
[InstCombine] propagate 'exact' when converting ashr to lshr

The shift amount is not changing, so if we guaranteed
shifting out zeros before, those bits are still zeros.

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

21 months ago[InstCombine] add tests for ashr exact; NFC
Sanjay Patel [Fri, 7 Oct 2022 17:03:56 +0000 (13:03 -0400)]
[InstCombine] add tests for ashr exact; NFC

21 months ago[InstCombine] add tests for sdiv-of-shl-1; NFC
Sanjay Patel [Fri, 7 Oct 2022 15:38:25 +0000 (11:38 -0400)]
[InstCombine] add tests for sdiv-of-shl-1; NFC

21 months ago[flang][nfc] Relocate a few driver tests
Andrzej Warzynski [Wed, 27 Jul 2022 13:54:45 +0000 (13:54 +0000)]
[flang][nfc] Relocate a few driver tests

When the work on the Flang driver started, we created 2 test
directories:
  * flang/test/Frontend/
  * flang/test/Driver/
That was mostly done to model what Clang was doing. In practice, we
stopped using "flang/test/Frontend/" early on and most Flang driver
tests are currently located in "flang/test/Driver/". This patch moves
the remaining tests from the latter into the former directory.

This change also means that we can re-use test input files, i.e.
flang/test/Frontend/Inputs/hello-world.f90 can be replaced with
flang/test/Driver/Inputs/hello.f90. To this end, the affected test is
updated (multiple-input-files.f90).

Differential Revision: https://reviews.llvm.org/D130633

21 months agoRevert "[SCEV] Support clearing Block/LoopDispositions for a single value."
Florian Hahn [Fri, 7 Oct 2022 16:58:53 +0000 (17:58 +0100)]
Revert "[SCEV] Support clearing Block/LoopDispositions for a single value."

This reverts commit 9e931439ddb9b6b8f655940b9d8ed6db50c2a7e2.

This commit causes a crash when TSan, e.g. with
https://lab.llvm.org/buildbot/#/builders/70/builds/28309/steps/10/logs/stdio

Reverting while I extract a reproducer and submit a fix.

21 months ago[InstrProf][llvm-profdata] Dump profile correlation data as YAML
Ellis Hoag [Fri, 7 Oct 2022 16:27:40 +0000 (09:27 -0700)]
[InstrProf][llvm-profdata] Dump profile correlation data as YAML

Change the behavior of the `llvm-profdata show --debug-info=` command to dump a YAML file when using debug info correlation since it provides more information in a parseable format.

Reviewed By: yozhu, phosek

Differential Revision: https://reviews.llvm.org/D134770

21 months ago[llvm-profdata] Add --output-format option
Ellis Hoag [Tue, 4 Oct 2022 00:48:50 +0000 (17:48 -0700)]
[llvm-profdata] Add --output-format option

Add `--output-format` option for the `llvm-profdata show` command to select the type of output. The existing `--text` flag is used to emit text encoded profiles. To avoid confusion, `--output-format=text-encoding` indicates that the output will be profiles encoded in the text format, and `--output-format=text` indicates the default text output that doesn't necessarily represent a profile.
`--output-format=json` is an alias for `--json` and `--output-format=yaml` will be used in D134770.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D135127

21 months ago[mlir][Linalg] Retire LinalgStrategyPadPass and filter-based pattern.
Nicolas Vasilache [Fri, 7 Oct 2022 16:00:48 +0000 (09:00 -0700)]
[mlir][Linalg] Retire LinalgStrategyPadPass and filter-based pattern.

Context: https://discourse.llvm.org/t/psa-retire-linalg-filter-based-patterns/63785

Differential Revision: https://reviews.llvm.org/D135454

21 months ago[Libomptarget] Remove debug definitions DeviceRTL's CMake
Joseph Huber [Fri, 7 Oct 2022 15:43:34 +0000 (10:43 -0500)]
[Libomptarget] Remove debug definitions DeviceRTL's CMake

These debugging definitions are no longer used in the new runtime. The
old runtime has been removed since Clang-14 so we can safely get rid of
these leftover variables.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D135452

21 months ago[Hexagon] Formatting changes, NFC
Krzysztof Parzyszek [Thu, 6 Oct 2022 23:09:50 +0000 (16:09 -0700)]
[Hexagon] Formatting changes, NFC

21 months ago[Hexagon] Add couple of helper functions in HexagonVectorCombine
Krzysztof Parzyszek [Thu, 6 Oct 2022 23:02:10 +0000 (16:02 -0700)]
[Hexagon] Add couple of helper functions in HexagonVectorCombine

1. `length(value/type)`: return the number of elements in the vector
   input,
2. `getHvxTy(elem_type)`: return the HVX vector type with the element
   type provided.

These will help write things more succintly.