platform/upstream/llvm.git
2 years ago[Hexagon] Enable IAS in the Hexagon backend
Brad Smith [Fri, 3 Jun 2022 22:15:12 +0000 (18:15 -0400)]
[Hexagon] Enable IAS in the Hexagon backend

Reviewed By: kparzysz

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

2 years ago[clang] Allow const variables with weak attribute to be overridden
Anders Waldenborg [Tue, 24 May 2022 19:46:32 +0000 (21:46 +0200)]
[clang] Allow const variables with weak attribute to be overridden

A variable with `weak` attribute signifies that it can be replaced with
a "strong" symbol link time. Therefore it must not emitted with
"weak_odr" linkage, as that allows the backend to use its value in
optimizations.

The frontend already considers weak const variables as
non-constant (note_constexpr_var_init_weak diagnostic) so this change
makes frontend and backend consistent.

This commit reverses the
  f49573d1 weak globals that are const should get weak_odr linkage.
commit from 2009-08-05 which introduced this behavior. Unfortunately
that commit doesn't provide any details on why the change was made.

This was discussed in
https://discourse.llvm.org/t/weak-attribute-semantics-on-const-variables/62311

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

2 years ago[Clang] Change the offload packager build to be a clang tool
Joseph Huber [Fri, 3 Jun 2022 21:33:56 +0000 (17:33 -0400)]
[Clang] Change the offload packager build to be a clang tool

Summary:
This patch changes the CMake build configruation for the
`clang-offload-packager` to be a clang tool rather than an executable.

2 years ago[mlir] Add peeling xform to Codegen Strategy
Diego Caballero [Fri, 3 Jun 2022 21:31:43 +0000 (21:31 +0000)]
[mlir] Add peeling xform to Codegen Strategy

This patch adds the knobs to use peeling in the codegen strategy
infrastructure.

Reviewed By: springerm

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

2 years ago[BOLT][NFC] Warning for deprecated option '-reorder-blocks=cache+'
Huan Nguyen [Fri, 3 Jun 2022 21:16:24 +0000 (14:16 -0700)]
[BOLT][NFC] Warning for deprecated option '-reorder-blocks=cache+'

Emit warning when using deprecated option '-reorder-blocks=cache+'.
Auto switch to option '-reorder-blocks=ext-tsp'.

Test Plan:
```
ninja check-bolt
```
Added a new test cache+-deprecated.test.
Run and verify that the upstream tests are passed.

Reviewed By: rafauler, Amir, maksfb

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

2 years agoAMDGPU: allow reordering of functions in AMDGPUResourceUsageAnalysis
Jacob Weightman [Fri, 3 Jun 2022 20:52:55 +0000 (15:52 -0500)]
AMDGPU: allow reordering of functions in AMDGPUResourceUsageAnalysis

The AMDGPUResourceUsageAnalysis was previously a CGSCC pass, and assumed
that a function's callees were always analyzed prior to their callees.
When it was refactored into a module pass, this assumption no longer
always holds. This results in calls being erroneously identified as
indirect, and reserving private segment space for them. This results in
significantly slower kernel launch latency.

This patch changes the order in which the module's functions are analyzed
from the order in which they occur in the module to a post-order traversal
of the call graph. Perhaps Clang always generates the module's functions
in such an order, but this is not the case for the Cray Fortran compiler.

Reviewed By: #amdgpu, arsenm

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

2 years ago[RISCV] Pre-commit test cases for D126986. NFC
Craig Topper [Fri, 3 Jun 2022 20:29:46 +0000 (13:29 -0700)]
[RISCV] Pre-commit test cases for D126986. NFC

2 years ago[bazel] Update build for config.h.cmake change
Reid Kleckner [Fri, 3 Jun 2022 19:56:48 +0000 (12:56 -0700)]
[bazel] Update build for config.h.cmake change

2 years ago[libc] Make expm1f correctly rounded when the targets have no FMA instructions.
Tue Ly [Sat, 9 Apr 2022 04:12:50 +0000 (00:12 -0400)]
[libc] Make expm1f correctly rounded when the targets have no FMA instructions.

Add another exceptional value and fix the case when |x| is small.

Performance tests with CORE-MATH project scripts:
With FMA instructions on Ryzen 1700:
```
$ ./perf.sh expm1f
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH reciprocal throughput   : 15.362
System LIBC reciprocal throughput : 53.194
LIBC reciprocal throughput        : 14.595
$ ./perf.sh expm1f --latency
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH latency   : 57.755
System LIBC latency : 147.020
LIBC latency        : 60.269
```
Without FMA instructions:
```
$ ./perf.sh expm1f
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH reciprocal throughput   : 15.362
System LIBC reciprocal throughput : 53.300
LIBC reciprocal throughput        : 18.020
$ ./perf.sh expm1f --latency
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH latency   : 57.758
System LIBC latency : 147.025
LIBC latency        : 70.304
```

Reviewed By: michaelrj

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

2 years ago[libc++][test] Skip string_view tests for other vendors on older modes
Joe Loser [Thu, 2 Jun 2022 03:22:17 +0000 (21:22 -0600)]
[libc++][test] Skip string_view tests for other vendors on older modes

`string_view` is supported all the way back to C++03 as an extension in
`libc++`, and so many of the tests run in all standards modes for all vendors.
This is unlikely desired by other standard library vendors using our test suite.
So, disable the tests for vendors other than `libc++` in these older standards
modes.

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

2 years ago[lld-macho] Addressed additional post-commit comments from D126046
Vy Nguyen [Wed, 1 Jun 2022 16:54:41 +0000 (12:54 -0400)]
[lld-macho] Addressed additional post-commit comments from  D126046

- fixed newlines
- renamed helper function for clarity
- added additional comment

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

2 years ago[ARM] Make a narrow tMOVi8 where possible in SEH prologues
Martin Storsjö [Wed, 1 Jun 2022 21:12:16 +0000 (00:12 +0300)]
[ARM] Make a narrow tMOVi8 where possible in SEH prologues

We intentionally disable Thumb2SizeReduction for SEH
prologues/epilogues, to avoid needing to guess what will happen with
the instructions in a potential future pass in frame lowering.

But for this specific case, where we know we can express the
intent with a narrow instruction, change to that instruction form
directly in frame lowering.

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

2 years ago[ARM] Make narrow push/pop in SEH prologues/epilogues where applicable
Martin Storsjö [Wed, 1 Jun 2022 19:38:41 +0000 (22:38 +0300)]
[ARM] Make narrow push/pop in SEH prologues/epilogues where applicable

We intentionally disable Thumb2SizeReduction for SEH
prologues/epilogues, to avoid needing to guess what will happen with
the instructions in a potential future pass in frame lowering.

But for this specific case, where we know we can express the
intent with a narrow instruction, change to that instruction form
directly in frame lowering.

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

2 years agoRevert "[X86] combineConcatVectorOps - add support for concatenation VSELECT/BLENDV...
Eric Christopher [Fri, 3 Jun 2022 19:07:58 +0000 (12:07 -0700)]
Revert "[X86] combineConcatVectorOps - add support for concatenation VSELECT/BLENDV nodes"

See the original commit for a testcase.

This reverts commit ea8fb3b6019642a3a032fd65588eb8460439d2f9.

2 years ago[OpenMP] allow loc to be NULL in __kmp_determine_reduction_method for MSVC
Vadim Paretsky [Fri, 3 Jun 2022 19:10:25 +0000 (14:10 -0500)]
[OpenMP] allow loc to be NULL in __kmp_determine_reduction_method for MSVC

MSVC may not supply source location information to kmpc_reduce passing
NULL for the value. The patch adds a check for the loc value being NULL
in kmp_determine_reduction_method.

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

2 years ago[Matrix] Add dot product tests
Vir Narula [Fri, 3 Jun 2022 19:02:42 +0000 (20:02 +0100)]
[Matrix] Add dot product tests

LLVM LIT tests for our upcoming dot product lowering change

Reviewed By: fhahn

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

2 years ago[clang][dataflow] Modify `optional` model to handle type aliases.
Yitzhak Mandelbaum [Fri, 3 Jun 2022 16:21:27 +0000 (16:21 +0000)]
[clang][dataflow] Modify `optional` model to handle type aliases.

Previously, type aliases were not handled (and resulted in an assertion
firing). This patch generalizes the model to consider aliases everywhere (a
previous patch already considered aliases for optional-returning functions).

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

2 years ago[pseudo] Add CLANG_PSEUDO_GEN cmake cache variable to avoid nested CMake invocation
Sam McCall [Tue, 31 May 2022 19:10:13 +0000 (21:10 +0200)]
[pseudo] Add CLANG_PSEUDO_GEN cmake cache variable to avoid nested CMake invocation

Similar to LLVM_TABLEGEN, CLANG_TABLEGEN variables

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

2 years ago[pseudo] rename pseudo-gen -> clang-pseudo-gen. NFC
Sam McCall [Tue, 31 May 2022 22:07:30 +0000 (00:07 +0200)]
[pseudo] rename pseudo-gen -> clang-pseudo-gen. NFC

This name is not namespaced. Requested in D126717

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

2 years ago[lld][WebAssembly] Remove unnecessary accessor methods. NFC
Sam Clegg [Fri, 3 Jun 2022 17:47:53 +0000 (10:47 -0700)]
[lld][WebAssembly] Remove unnecessary accessor methods. NFC

This is less code, and matches more closely the ELF linker.

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

2 years ago[bazel] Port 95aff23e2921
Benjamin Kramer [Fri, 3 Jun 2022 18:43:02 +0000 (20:43 +0200)]
[bazel] Port 95aff23e2921

2 years ago[pseudo] Eliminate dependencies from clang-pseudo-gen. NFC
Sam McCall [Tue, 31 May 2022 23:02:47 +0000 (01:02 +0200)]
[pseudo] Eliminate dependencies from clang-pseudo-gen. NFC

ClangBasic dependency eliminated by replacing our usage of
tok::getPunctuatorSpelling etc with direct use of the *.def file.

Implicit dependencies on clang-tablegen-targets removed as we manage to avoid
any transitive tablegen deps.

After these changes, `ninja clean; ninja pseudo-gen` runs 169 actions only
(basically Support and Demangle).

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

2 years agoCommandObjectRegexCommand shouldn't put two commands on the history stack.
Jim Ingham [Fri, 3 Jun 2022 18:32:43 +0000 (11:32 -0700)]
CommandObjectRegexCommand shouldn't put two commands on the history stack.

It was putting the command the user typed, and then the resolved command in the
command history.  That caused up-arrow not to work correctly when the regex command
was invoked from a Python-command.  Plus it's just weird.

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

2 years ago[libc++] Forward more often to memmove in copy
Nikolas Klauser [Fri, 3 Jun 2022 10:50:39 +0000 (12:50 +0200)]
[libc++] Forward more often to memmove in copy

In D122982 I accidentally disabled the memmove optimization. This re-enables it and adds more cases where copy forwards to memmove.
Fixes https://github.com/llvm/llvm-project/issues/33687

Reviewed By: var-const, #libc, ldionne

Spies: pkasting, ayzhao, dcheng, xbolva00, libcxx-commits

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

2 years ago[MSAN] Exclude dn_expand test from Android.
Kevin Athey [Fri, 3 Jun 2022 18:14:59 +0000 (11:14 -0700)]
[MSAN] Exclude dn_expand test from Android.

Depends on 1a729bce8617

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

2 years ago[NFC] Fix issue on CMake Xcode build configuration.
python3kgae [Thu, 2 Jun 2022 16:39:01 +0000 (09:39 -0700)]
[NFC] Fix issue on CMake Xcode build configuration.

add missing dependency for hlsl-resource-headers and clang-resource-headers.

Reviewed By: rastogishubham

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

2 years ago[RISCV] Use SelectionDAG::isBaseWithConstantOffset in scalar load/store address matching.
Craig Topper [Fri, 3 Jun 2022 17:53:39 +0000 (10:53 -0700)]
[RISCV] Use SelectionDAG::isBaseWithConstantOffset in scalar load/store address matching.

Test changes are because isBaseWithConstantOffset uses computeKnownBits
and that is able to see that an earlier AND instruction guaranteed
alignment so that we can treat an OR as an ADD.

Reviewed By: reames

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

2 years ago[config] Remove LLVM_DEFAULT_TARGET_TRILE from config.h
Reid Kleckner [Fri, 3 Jun 2022 17:08:53 +0000 (10:08 -0700)]
[config] Remove LLVM_DEFAULT_TARGET_TRILE from config.h

It is redundant with llvm-config.h, which is always included by
config.h.

Port D12660 / d178f4fc895b432008fcd8a0a49a13d951fecfe4 from config.h to
llvm-config.h.

Update the gn build accordingly.

NFCI

2 years agoRe-land "[mlir] Add integer range inference analysis""
Krzysztof Drewniak [Thu, 2 Jun 2022 21:45:52 +0000 (21:45 +0000)]
Re-land "[mlir] Add integer range inference analysis""

This reverts commit 4e5ce2056e3e85f109a074e80bdd23a10ca2bed9.

This relands commit 1350c9887dca5ba80af8e3c1e61b29d6696eb240.

Reinstates the range analysis with the build issue fixed.

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

2 years ago[LLVM] [NFC] remove unnecessary, confusing scope
Florian Mayer [Fri, 3 Jun 2022 01:11:42 +0000 (18:11 -0700)]
[LLVM] [NFC] remove unnecessary, confusing scope

Reviewed By: dmgreen

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

2 years ago[MSAN] add dn_expand intercept.
Kevin Athey [Thu, 2 Jun 2022 21:18:00 +0000 (14:18 -0700)]
[MSAN] add dn_expand intercept.

This interceptor only addresses writes to inputs.  Reads of inputs are not checked.

Reviewed By: vitalybuka

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

2 years agollvm: cmake: set CMP0114 to OLD to avoid warning
Nick Desaulniers [Fri, 3 Jun 2022 16:33:04 +0000 (09:33 -0700)]
llvm: cmake: set CMP0114 to OLD to avoid warning

Building with cmake 3.23.2+ produces warnings when using
LLVM_ENABLE_RUNTIMES. Set this policy to the existing behavior for now
to silence the warnings.

Fixes: https://github.com/llvm/llvm-project/issues/50122
Fixes: https://github.com/llvm/llvm-project/issues/54944

Reviewed By: phosek, penzn

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

2 years ago[Attributes] Remove AttrSyntax and migrate uses to AttributeCommonInfo::Syntax (NFC)
Leonard Grey [Thu, 2 Jun 2022 17:30:43 +0000 (13:30 -0400)]
[Attributes] Remove AttrSyntax and migrate uses to AttributeCommonInfo::Syntax (NFC)

This is setup for allowing hasAttribute to work for plugin-provided attributes

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

2 years ago[BOLT] Cache-Aware Tail Duplication
spupyrev [Fri, 3 Jun 2022 16:08:45 +0000 (09:08 -0700)]
[BOLT] Cache-Aware Tail Duplication

A new "cache-aware" strategy for tail duplication.

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

2 years ago[RISCV] Reduce scalar load/store isel patterns to a single ComplexPattern. NFCI
Craig Topper [Fri, 3 Jun 2022 05:08:51 +0000 (22:08 -0700)]
[RISCV] Reduce scalar load/store isel patterns to a single ComplexPattern. NFCI

Previously we had 3 different isel patterns for every scalar load
store instruction.

This reduces them to a single ComplexPattern that returns the Base
and Offset. Or an offset of 0 if there was no offset identified

I've done a similar thing for the 2 isel patterns that match add/or
with FrameIndex and immediate. Using the offset of 0, I was also
able to remove the custom handler for FrameIndex. Happy to split that
to another patch.

We might be able to enhance in the future to remove the post-isel
peephole or the special handling for ADD with constant added by D126576.

A nice side effect is that this removes nearly 3000 bytes from the isel
table.

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

2 years ago[COFF] Fix -Wredundant-move
Benjamin Kramer [Fri, 3 Jun 2022 15:39:08 +0000 (17:39 +0200)]
[COFF] Fix -Wredundant-move

2 years ago[COFF] Check table ptr more thoroughly and ignore empty sections
Alvin Wong [Fri, 3 Jun 2022 14:57:57 +0000 (17:57 +0300)]
[COFF] Check table ptr more thoroughly and ignore empty sections

When loading split debug files for PE/COFF executables (produced with
`objcopy --only-keep-debug`), the tables or directories in such files
may point to data inside sections that may have been stripped.
COFFObjectFile shall detect and gracefully handle this, to allow the
object file be loaded without considering these tables or directories.
This is required for LLDB to load these files for use as debug symbols.

COFFObjectFile shall also check these pointers more carefully to account
for cases in which the section contains less raw data than the size
given by VirtualSize, to prevent going out of bounds.

This commit also changes COFFDump in llvm-objdump to reuse the pointers
that are already range-checked in COFFObjectFile. This fixes a crash
when trying to dump the TLS directory from a stripped file.

Fixes https://github.com/mstorsjo/llvm-mingw/issues/284

Reviewed By: rnk

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

2 years ago[SLP]Improve shuffles cost estimation where possible.
Alexey Bataev [Thu, 9 Dec 2021 18:34:08 +0000 (10:34 -0800)]
[SLP]Improve shuffles cost estimation where possible.

Improved/fixed cost modeling for shuffles by providing masks, improved
cost model for non-identity insertelements.

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

2 years ago[docs] Remove a link to an outdated Go docs
Yuki Okushi [Thu, 2 Jun 2022 11:50:26 +0000 (20:50 +0900)]
[docs] Remove a link to an outdated Go docs

That link returns 404, we have bindings code on https://github.com/llvm/llvm-project/tree/main/llvm/bindings/go
but it seems we haven't published it and there are no docs yet.

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

2 years ago[gn build] Extract compiled_action.gni from tablegen.gni
Nico Weber [Fri, 3 Jun 2022 14:02:06 +0000 (10:02 -0400)]
[gn build] Extract compiled_action.gni from tablegen.gni

After years of tablegen being the only host binary we run as part
of the build, we're now in the process of growing at least two more:
- make_confusable_table (https://reviews.llvm.org/rG180bae08a04d)
- pseudo-gen (not yet fully hooked up in the GN build, but I have
  a local branch that hooks it up)

Factor out the few lines we need for running a host binary as part of the
build.

No behavior change.

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

2 years agoOnly issue warning for subtraction involving null pointers on live code paths
Jamie Schmeiser [Fri, 3 Jun 2022 14:10:37 +0000 (10:10 -0400)]
Only issue warning for subtraction involving null pointers on live code paths

Summary:
Change the warning produced for subtraction from (or with) a null pointer
to only be produced when the code path is live.
https://github.com/llvm/llvm-project/issues/54570

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: anarazel (Andres Freund)
Differential Revision: https://reviews.llvm.org/D126816

2 years ago[coro async] Add code to support dynamic aligment of over-aligned types in async...
Arnold Schwaighofer [Fri, 27 May 2022 21:34:55 +0000 (14:34 -0700)]
[coro async] Add code to support dynamic aligment of over-aligned types in async frames

Async context frames are allocated with a maximum alignment. If a type
requests an alignment bigger than that dynamically align the address
in the frame.

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

2 years ago[clang][dataflow] Model calls returning optionals
Stanislav Gatev [Wed, 1 Jun 2022 08:43:30 +0000 (08:43 +0000)]
[clang][dataflow] Model calls returning optionals

Model calls returning optionals

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

Reviewed-by: ymandel, xazax.hun
2 years agoRevert "[clang-tidy] Confusable identifiers detection"
Nico Weber [Fri, 3 Jun 2022 13:29:10 +0000 (09:29 -0400)]
Revert "[clang-tidy] Confusable identifiers detection"

This reverts commit b94db7ed7eaf4a3b21f600653a09c55cab77b79f.
See comments on https://reviews.llvm.org/D112916:
- breaks `check-clangd`, and makes clang-tidy crash on simple inputs
- likely does the wrong thing in cross builds

Also revert follow-up "[gn build] (manually) port b94db7ed7eaf (Confusables.inc)"
This reverts commit 180bae08a04d4dc724cb5e6f2ea9df8641a3f657.

2 years agocheck_clang_tidy.py: Update run line to python3
Nico Weber [Fri, 3 Jun 2022 13:28:07 +0000 (09:28 -0400)]
check_clang_tidy.py: Update run line to python3

`python` no longer exists on several systems, and the script
runs under python3 when run as part of lit.

2 years ago[lldb] [Process/FreeBSD] Do not send SIGSTOP to stopped process
Michał Górny [Wed, 1 Jun 2022 11:00:43 +0000 (13:00 +0200)]
[lldb] [Process/FreeBSD] Do not send SIGSTOP to stopped process

Do not send SIGSTOP when requested to halt a process that's already
stopped.  This results in the signal being queued for delivery once
the process is resumed, and unexpectedly stopping it again.

This is necessary for non-stop protocol patches to land.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D126770

2 years agoCorrect the behavior of this test for non-Windows targets
Aaron Ballman [Fri, 3 Jun 2022 12:59:00 +0000 (08:59 -0400)]
Correct the behavior of this test for non-Windows targets

This should address build failures like:
https://lab.llvm.org/buildbot/#/builders/188/builds/14980
https://lab.llvm.org/buildbot/#/builders/171/builds/15515
https://lab.llvm.org/buildbot/#/builders/91/builds/9877

2 years ago[SCCP] Regenerate test checks with function signature (NFC)
Nikita Popov [Fri, 3 Jun 2022 12:36:47 +0000 (14:36 +0200)]
[SCCP] Regenerate test checks with function signature (NFC)

The previous checks were manually modified to avoid the label
clash. Use the --function-signature flag that exists for this
purpose.

2 years agoUpdating more entries in the C DR Status page
Aaron Ballman [Fri, 3 Jun 2022 12:28:16 +0000 (08:28 -0400)]
Updating more entries in the C DR Status page

Adds test coverage or information for ~25 more C DRs.

2 years ago[SCCP] Regenerate test checks (NFC)
Nikita Popov [Fri, 3 Jun 2022 12:27:20 +0000 (14:27 +0200)]
[SCCP] Regenerate test checks (NFC)

2 years agoUpdate old mailing list link in the nullability doc
Hans Wennborg [Fri, 3 Jun 2022 12:23:41 +0000 (14:23 +0200)]
Update old mailing list link in the nullability doc

2 years ago[VPlan] Silence another unused variable warning in release builds
Benjamin Kramer [Fri, 3 Jun 2022 12:07:56 +0000 (14:07 +0200)]
[VPlan] Silence another unused variable warning in release builds

2 years ago[mlir][complex] Check the correctness of tanh in complex dialect
lewuathe [Fri, 3 Jun 2022 12:04:04 +0000 (14:04 +0200)]
[mlir][complex] Check the correctness of tanh in complex dialect

Correctness check for tanh operation in complex dialect.

Ref: https://reviews.llvm.org/D126858

Reviewed By: pifon2a

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

2 years ago[VPlan] Inline variable into assertion. NFC.
Benjamin Kramer [Fri, 3 Jun 2022 11:59:48 +0000 (13:59 +0200)]
[VPlan] Inline variable into assertion. NFC.

Avoids a warning in release builds
llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp:311:14: warning: unused variable 'BrCond' [-Wunused-variable]
      Value *BrCond = Br->getCondition();

2 years ago[gn build] (manually) port b94db7ed7eaf (Confusables.inc)
Nico Weber [Fri, 3 Jun 2022 11:49:28 +0000 (07:49 -0400)]
[gn build] (manually) port b94db7ed7eaf (Confusables.inc)

2 years ago[pp-trace] Print HashLoc in InclusionDirective callback
CHIANG, YU-HSUN (Tommy Chiang, oToToT) [Tue, 10 May 2022 01:53:16 +0000 (09:53 +0800)]
[pp-trace] Print HashLoc in InclusionDirective callback

The HashLoc in InclusionDirective callback is an unused parameter.
Since pp-trace is also used as a test of Clang’s PPCallbacks interface,
add it to the output of pp-trace could avoid some unintended change on
it.

This shuold resolves PR52673

Reviewed By: aaron.ballman

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

2 years ago[DAGCombiner] Add bf16 to the matrix of types that we don't promote to integer stores
Benjamin Kramer [Fri, 3 Jun 2022 11:25:40 +0000 (13:25 +0200)]
[DAGCombiner] Add bf16 to the matrix of types that we don't promote to integer stores

Remove a few stray semicolons while there.

2 years ago[SVE] Refactor sve-bitcast.ll to include all combinations for legal types.
Paul Walker [Tue, 31 May 2022 09:57:15 +0000 (10:57 +0100)]
[SVE] Refactor sve-bitcast.ll to include all combinations for legal types.

Patch enables custom lowering for MVT::nxv4bf16 because otherwise
the refactored test file triggers a selection failure.

The reason for the refactoring it to highlight cases where the
generated code is wrong.

2 years ago[VPlan] Update failing HCFG unit tests after a5bb4a3b4d3db.
Florian Hahn [Fri, 3 Jun 2022 11:05:00 +0000 (12:05 +0100)]
[VPlan] Update failing HCFG unit tests after a5bb4a3b4d3db.

2 years ago[VPlan] Replace CondBit with BranchOnCond VPInstruction.
Florian Hahn [Fri, 3 Jun 2022 10:47:16 +0000 (11:47 +0100)]
[VPlan] Replace CondBit with BranchOnCond VPInstruction.

This patch removes CondBit and Predicate from VPBasicBlock. To do so,
the patch introduces a new branch-on-cond VPInstruction opcode to model
a branch on a condition explicitly.

This addresses a long-standing TODO/FIXME that blocks shouldn't be users
of VPValues. Those extra users can cause issues for VPValue-based
analyses that don't expect blocks. Addressing this fixme should allow us
to re-introduce 266ea446ab7476.

The generic branch opcode can also be used in follow-up patches.

Depends on D123005.

Reviewed By: Ayal

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

2 years ago[mlir] Fix ClangTidy warning (NFC).
Adrian Kuegel [Fri, 3 Jun 2022 10:46:14 +0000 (12:46 +0200)]
[mlir] Fix ClangTidy warning (NFC).

virtual is redundant since the function is already declared 'override'.

2 years ago[AArch64] Add extra addp codegen tests. NFC
David Green [Fri, 3 Jun 2022 10:36:40 +0000 (11:36 +0100)]
[AArch64] Add extra addp codegen tests. NFC

2 years ago[clang-tidy] Confusable identifiers detection
serge-sans-paille [Fri, 15 Oct 2021 13:20:22 +0000 (15:20 +0200)]
[clang-tidy] Confusable identifiers detection

Detect identifiers that are confusable according to Unicode definition

        http://www.unicode.org/reports/tr39/#Confusable_Detection

and have conflicting scopes.

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

2 years ago[docs] Fix RST code-block syntax in HowToSetUpLLVMStyleRTTI.rst
Kristof Beyls [Fri, 3 Jun 2022 09:24:49 +0000 (11:24 +0200)]
[docs] Fix RST code-block syntax in HowToSetUpLLVMStyleRTTI.rst

2 years ago[gn build] Port a29a1a33ac7b
LLVM GN Syncbot [Fri, 3 Jun 2022 08:36:05 +0000 (08:36 +0000)]
[gn build] Port a29a1a33ac7b

2 years ago[clang-tidy] Add missing close quote in release notes.
Martin Boehme [Fri, 3 Jun 2022 08:27:36 +0000 (10:27 +0200)]
[clang-tidy] Add missing close quote in release notes.

Sorry for the breakage.

2 years ago[libc++] Fix conjunction/disjunction and mark a few LWG issues as complete
Nikolas Klauser [Fri, 3 Jun 2022 08:31:30 +0000 (10:31 +0200)]
[libc++] Fix conjunction/disjunction and mark a few LWG issues as complete

Fixes #54803
Fixes #53133

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[cmake] Fix typo in CrossCompile.cmake
Jonas Hahnfeld [Fri, 3 Jun 2022 08:17:10 +0000 (10:17 +0200)]
[cmake] Fix typo in CrossCompile.cmake

2 years ago[flang][test-suite] Document need for NO_STOP_MESSAGE environment variable. NFC
Diana Picus [Wed, 25 May 2022 08:42:38 +0000 (08:42 +0000)]
[flang][test-suite] Document need for NO_STOP_MESSAGE environment variable. NFC

When running the llvm-test-suite with flang, we get a lot of failures
because of the output of the `STOP` statement. We can workaround them by
setting `NO_STOP_MESSAGE=1` in the environment. This patch adds a few
words about it to the docs about the Fortran part of the llvm-test-suite.

See also https://reviews.llvm.org/D126360

2 years ago[mlir][OpenMP] Add memory_order clause tests
Shraiysh Vaishay [Fri, 3 Jun 2022 07:31:07 +0000 (13:01 +0530)]
[mlir][OpenMP] Add memory_order clause tests

This patch adds tests for memory_order clause for atomic update and
capture operations. This patch also adds a check for making sure that
the operations inside and omp.atomic.capture region do not specify the
memory_order clause.

Reviewed By: kiranchandramohan, peixin

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

2 years ago[DAGCombine] Handle promotion of shift with both operands the same
Nikita Popov [Thu, 2 Jun 2022 15:09:07 +0000 (17:09 +0200)]
[DAGCombine] Handle promotion of shift with both operands the same

When promoting a shift, make sure we only fetch the second operand
after promoting the first. Load promotion may replace users of the
old load, and we don't want to be left with a dangling reference to
the old load instruction.

The crashing test case is from https://reviews.llvm.org/D126689#3553212.

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

2 years ago[NFC] Format CGBuilder.h
Guillaume Chatelet [Fri, 3 Jun 2022 07:53:36 +0000 (07:53 +0000)]
[NFC] Format CGBuilder.h

2 years ago[clang][sema] Remove unused paramter from VerifyBitField
Timm Bäder [Fri, 3 Jun 2022 07:42:01 +0000 (09:42 +0200)]
[clang][sema] Remove unused paramter from VerifyBitField

The ZeroWidth paramter is unused in every call site of VerifyBitField.

2 years ago[clang-tidy] `bugprone-use-after-move`: Fix handling of moves in lambda captures
Martin Boehme [Fri, 3 Jun 2022 07:08:17 +0000 (09:08 +0200)]
[clang-tidy] `bugprone-use-after-move`: Fix handling of moves in lambda captures

Previously, we were treating a move in the lambda capture as if it happened
within the body of the lambda, not within the function that defines the lambda.

This fixes the same bug as https://reviews.llvm.org/D119165 (which it appears
may have been abandoned by the author?) but does so more simply.

Reviewed By: njames93

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

2 years agoRevert "[SLP]Improve shuffles cost estimation where possible."
Fangrui Song [Fri, 3 Jun 2022 07:30:34 +0000 (00:30 -0700)]
Revert "[SLP]Improve shuffles cost estimation where possible."

This reverts commit 9980c9971892378ea82475e000de8df210a58e69.

Caused assertion failures: https://reviews.llvm.org/D115462#3555350

2 years ago[mlir][SCF] Add bufferization hook for scf.foreach_thread and terminator.
Nicolas Vasilache [Fri, 3 Jun 2022 07:13:06 +0000 (07:13 +0000)]
[mlir][SCF] Add bufferization hook for scf.foreach_thread and terminator.

`scf.foreach_thread` results alias with the underlying `scf.foreach_thread.parallel_insert_slice` destination operands
and they bufferize to equivalent buffers in the absence of other conflicts.
`scf.foreach_thread.parallel_insert_slice` conflict detection is similar to `tensor.insert_slice` conflict detection.

Reviewed By: springerm

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

2 years ago[Driver] Add multiarch path for RISC-V
Jonas Hahnfeld [Mon, 30 May 2022 18:54:21 +0000 (20:54 +0200)]
[Driver] Add multiarch path for RISC-V

This is required to find headers on the Debian port for RISC-V.

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

2 years ago[clang] [MSVC] Enable unwind tables for ARM
Martin Storsjö [Mon, 2 May 2022 21:22:27 +0000 (00:22 +0300)]
[clang] [MSVC] Enable unwind tables for ARM

The backend now can generate working unwind information for this
target.

Improve the existing windows-exceptions.cpp testcase to check for
the state of unwind tables on all MSVC architectures.

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

2 years ago[ARM] Fix restoring stack for varargs with SEH split frame pointer push
Martin Storsjö [Thu, 2 Jun 2022 10:17:14 +0000 (13:17 +0300)]
[ARM] Fix restoring stack for varargs with SEH split frame pointer push

Previously, the "add sp, #12" ended up inserted after "bx lr".

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

2 years ago[clang][driver] Dynamically select gcc-toolset/devtoolset
Timm Bäder [Wed, 18 May 2022 08:31:41 +0000 (10:31 +0200)]
[clang][driver] Dynamically select gcc-toolset/devtoolset

Instead of adding all devtoolset and gcc-toolset prefixes to the list of
prefixes, just scan the /opt/rh/ directory for the one with the highest
version number and only add that one.

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

2 years ago[mlir][cf] Implement missing SwitchOp::build function
Alexander Batashev [Fri, 3 Jun 2022 06:07:42 +0000 (09:07 +0300)]
[mlir][cf] Implement missing SwitchOp::build function

Reviewed By: rriddle

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

2 years ago[LLVM][Docs] Update for HowToSetUpLLVMStyleRTTI.rst, NFC.
bzcheeseman [Fri, 3 Jun 2022 04:58:14 +0000 (21:58 -0700)]
[LLVM][Docs] Update for HowToSetUpLLVMStyleRTTI.rst, NFC.

This patch updates the document with some advanced use cases and examples on how to set up and use LLVM-style RTTI. It includes a few motivating examples to get readers comfortable with the concepts.

Reviewed By: lattner

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

2 years ago[NFC][MemDep] Remove unnecessary Worklist.clear
Max Kazantsev [Fri, 3 Jun 2022 05:31:06 +0000 (12:31 +0700)]
[NFC][MemDep] Remove unnecessary Worklist.clear

This execution path leads to return 'false' where the Worklist
will be deallocated anyways. No need to clear it separately.

2 years ago[SSAUpdaterImpl] Do not generate phi node with all the same incoming values
Serguei Katkov [Fri, 27 May 2022 07:51:31 +0000 (14:51 +0700)]
[SSAUpdaterImpl] Do not generate phi node with all the same incoming values

If all available vals to basic block are the same - do not build new phi node and
just use this value.

Reviewed By: sameerds
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D126525

2 years ago[libc] Automatically add -mfma flag for architectures supporting FMA.
Tue Ly [Sun, 8 May 2022 17:47:08 +0000 (13:47 -0400)]
[libc] Automatically add -mfma flag for architectures supporting FMA.

Detect if the architecture supports FMA instructions and if
the targets depend on fma.

Reviewed By: gchatelet

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

2 years ago[M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588)
Douglas Chen [Fri, 3 Jun 2022 05:19:03 +0000 (13:19 +0800)]
[M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588)

This patch is trying to fix issue 48588(https://github.com/llvm/llvm-project/issues/48588)

I found the results of Instruction Selection between SelectionDAG and FastISEL for the `%mul = mul i32 %A, 4294967295`:
(seldag-isel) mul --> sub --> SUB32dp
(fast-isel)   mul --> sub --> NEG32d

My patch to fix this issue is by overriding a virtual function M68kDAGToDAGISel::IsProfitableToFold(). Return `false` when it was trying to match with SUB, then it will match with NEG.

Reviewed By: myhsu

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

2 years ago[mlir][VectorToGPU] Fix bug generating incorrect ldmatrix ops
Thomas Raoux [Fri, 3 Jun 2022 04:23:27 +0000 (04:23 +0000)]
[mlir][VectorToGPU] Fix bug generating incorrect ldmatrix ops

ldmatrix transpose can only be used with types that are 16bits wide.

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

2 years ago[MachineSSAUpdate] Add a test for redundant phi generation.
Serguei Katkov [Fri, 27 May 2022 05:17:46 +0000 (12:17 +0700)]
[MachineSSAUpdate] Add a test for redundant phi generation.

2 years ago[mlir][scf] Add option to loop pipelining to not peel the epilogue
Thomas Raoux [Wed, 1 Jun 2022 05:42:00 +0000 (05:42 +0000)]
[mlir][scf] Add option to loop pipelining to not peel the epilogue

Add an option to predicate the epilogue within the kernel instead of
peeling the epilogue. This is a useful option to prevent generating
large amount of code for deep pipeline. This currently require a user
lamdba to implement operation predication.

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

2 years ago[RISCV] Give CSImm12MulBy4 PatLeaf priority over CSImm12MulBy8. NFC
Craig Topper [Fri, 3 Jun 2022 03:49:15 +0000 (20:49 -0700)]
[RISCV] Give CSImm12MulBy4 PatLeaf priority over CSImm12MulBy8. NFC

The immediate range check for CSImm12MulBy8 included some values
covered by CSImm12MulBy4. I assume CSImm12MulBy4 had priority due
to pattern order in the td file, but this makes the priority
explicit in the predicate.

2 years ago[llvm-c-test] Default to opaque pointers
Fangrui Song [Fri, 3 Jun 2022 03:34:52 +0000 (20:34 -0700)]
[llvm-c-test] Default to opaque pointers

2 years ago[llvm-c][test] Convert tests to opaque pointers
Fangrui Song [Fri, 3 Jun 2022 03:27:10 +0000 (20:27 -0700)]
[llvm-c][test] Convert tests to opaque pointers

echo.ll is unchanged to test typed pointers.

2 years ago[mlir][NFC] Simplify the various `parseSourceFile<T>` overloads
River Riddle [Thu, 2 Jun 2022 04:00:49 +0000 (21:00 -0700)]
[mlir][NFC] Simplify the various `parseSourceFile<T>` overloads

These effectively all share the same implementation, i.e. forward
to the non-templated overload and then construct the container op.

2 years ago[BOLT][NFC] Make ICP::verifyProfile static
Amir Ayupov [Fri, 3 Jun 2022 02:08:59 +0000 (19:08 -0700)]
[BOLT][NFC] Make ICP::verifyProfile static

Follow LLVM style guide suggestion to avoid function definitions in anonymous
namespaces: https://llvm.org/docs/CodingStandards.html#anonymous-namespaces

Reviewed By: rafauler

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

2 years ago[NFC][Doc] Finish atomic compare
Shilei Tian [Fri, 3 Jun 2022 01:50:07 +0000 (21:50 -0400)]
[NFC][Doc] Finish atomic compare

2 years ago[Clang][OpenMP] Add the codegen support for `atomic compare capture`
Shilei Tian [Fri, 3 Jun 2022 01:38:12 +0000 (21:38 -0400)]
[Clang][OpenMP] Add the codegen support for `atomic compare capture`

This patch adds the codegen support for `atomic compare capture` in clang.

Reviewed By: ABataev

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

2 years ago[BOLT][DOCS] Add PACKAGE_VERSION to doxygen config
Amir Ayupov [Mon, 23 May 2022 04:44:27 +0000 (21:44 -0700)]
[BOLT][DOCS] Add PACKAGE_VERSION to doxygen config

Clang's doxygen documentation specifies LLVM revision. Do the same for BOLT.

Reviewed By: rafauler

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

2 years agoRevert "[LoopInterchange] New cost model for loop interchange"
Daniil Suchkov [Fri, 3 Jun 2022 00:52:08 +0000 (00:52 +0000)]
Revert "[LoopInterchange] New cost model for loop interchange"

Reverting the commit due to numerous buildbot failures.

This reverts commit 006334470d8d1b5d8f630890336fcb45795749d1.

2 years ago[OpenMP][NFC] update status for 'omp_all_memory' directive to 'done'
Mike Rice [Fri, 3 Jun 2022 00:29:54 +0000 (17:29 -0700)]
[OpenMP][NFC] update status for 'omp_all_memory' directive to 'done'

2 years ago[Sema] Reject list-initialization of enumeration types from a
Akira Hatanaka [Fri, 20 May 2022 19:16:29 +0000 (12:16 -0700)]
[Sema] Reject list-initialization of enumeration types from a
brace-init-list containing a single element of a different scoped
enumeration type

It is rejected because it doesn't satisfy the condition that the element
has to be implicitly convertible to the underlying type of the
enumeration.

http://eel.is/c++draft/dcl.init.list#3.8

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