457291 Commits

Author SHA1 Message Date
Aiden Grossman
c19bc611bd [Docs][llvm-exegesis] Add documentation for --use-dummy-perf-counters
This patch adds in documentation for the --use-dummy-perf-counters
option (introduced in D146301).

Reviewed By: kpdev42

Differential Revision: https://reviews.llvm.org/D147842
2023-04-10 19:09:35 +00:00
ziqingluo-90
6341301509 [-Wunsafe-buffer-usage] Improve fix-its for local variable declarations with null pointer initializers
For a local pointer declaration of the form `T * p = 0` or `T * p = std::nullptr`,

Before this patch, we generate fix-its that convert the declaration to
`std::span<T> p{nullptr, <# placeholder #>}`, in cases where `p` is
used in some unsafe operations.  This patch improves the fix-its to
result in a simpler form `std::span<T> p`. It gets rid of the
placeholder and keeps the result concise.

Reviewed by: NoQ (Artem Dergachev)

Differential Revision: https://reviews.llvm.org/D143680
2023-04-10 12:08:30 -07:00
Jordan Rupprecht
5e57f1bf52 [bazel][NFC] Replace @bazel_tools//src/conditions with equivalent @platforms rules
Followup to D147354. Using src/conditions is discouraged in favor of using rules from the `@platforms` repository directly.

This replaces three conditions:
* `@bazel_tools//src/conditions:windows` -> `@platforms//os:windows`
* `@bazel_tools//src/conditions:darwin` -> `@platforms//os:macos`
* `@bazel_tools//src/conditions:freebsd` -> `@platforms//os:freebsd`

`llvm/config.bzl` has a non-trivial OS+CPU selection config, so that is omitted from this patch. There is intentionally no equivalent for that in `@platforms` because every project will have their own opinions about what a platform is, and it is not feasible for the bazel selection list to include every possible combination. The recommended idiom there is for projects to define their own supported platforms list, e.g. in a separate BUILD file or platform mapping.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D147948
2023-04-10 11:42:58 -07:00
Craig Topper
6de3afeaef [TableGen] Simplify how commuted variants are generated in GenerateVariantsOf. NFC
We don't need to copy the ChildVariants vector into a new vector.
We're using std::move on every entry we copy so they clearly
aren't needed again. We can swap entries in the vector and reuse
it instead.
2023-04-10 11:29:01 -07:00
Nico Weber
18777c7b0c [gn build] Port eb65912e41a1 2023-04-10 14:11:09 -04:00
Changpeng Fang
3bc1e084ee AMDGPU: Created a subclass for the return address operand in the tail call return instruction
Summary:
  This is to avoid using the callee saved registers for the return address
of the tail call return instruction.

Reviewers:
  arsenm, cdevadas

Differential Revision:
  https://reviews.llvm.org/D147096
2023-04-10 10:53:33 -07:00
Paul Kirth
a78816a6b6 [clang][driver] Pass -femulated-tls through to the linker in LTO mode
Currently the driver does not propagate the `-f[no-]emulated-tls` flags
to the linker under LTO. This can be surprising when the platform
defaults differ from the flags being passed. A related discussion can be
found in https://reviews.llvm.org/D143619. While the focus there was
RISC-V support, the root cause was that setting `-femualted-tls` and
`-flto` when compiling with Clang resulted in missing symbols because
the platform defaults for Android differed from the flags being passed
to Clang.

This patch changes the Clang driver's behavior to pass the emulated-tls
flags through to the linker when compiling with LTO/ThinLTO.

Reviewed By: phosek, vit9696

Differential Revision: https://reviews.llvm.org/D147834
2023-04-10 17:43:49 +00:00
Nikolas Klauser
eb65912e41 [libc++] Move __errc to __system_error/errc.h
This file was added before we started granularizing the headers, but is essentially just a granularized header. This moves the header to the correct place.

Reviewed By: #libc, EricWF

Spies: libcxx-commits, arichardson, mikhail.ramalho

Differential Revision: https://reviews.llvm.org/D146395
2023-04-10 19:23:42 +02:00
Augusto Noronha
19d969e340 [lldb] Implement SymbolFile::GetCompileOptions
Implement SymbolFile::GetCompileOptions, which returns a map from
compilation units to compilation arguments associated with that unit.

Differential Revision: https://reviews.llvm.org/D147748
2023-04-10 10:13:06 -07:00
Kazu Hirata
d5a50b02e6 Fix warnings
This patch fixes:

  mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp:1334:51:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

  lld/wasm/Writer.cpp:250:39: warning: suggest parentheses around ‘&&’
  within ‘||’ [-Wparentheses]
2023-04-10 10:11:41 -07:00
Michael Jones
d374d47469 [libc][obvious] fix new assert typo 2023-04-10 10:02:47 -07:00
Jeremy Kun
bfbccfa17c Add support for math.ctlz in convert-math-to-funcs
This change adds a software implementation of the `math.ctlz` operation
and includes it in `--convert-math-to-funcs`.

This is my first change to MLIR, so please bear with me as I'm still learning
the idioms of the codebase.

The context for this change is that I have some larger scale project in which
I'd like to lower from a mix of MLIR dialects to CIRCT, but many of the CIRCT
passes don't support the `math` dialect.

I noticed the content of `convert-math-to-funcs` was limited entirely to
the `pow` functions, but otherwise provided the needed structure to implement
this feature with minimal changes.

Highlight of the changes:

- Add a dependence on the SCF dialect for this lower. I could have lowered
  directly to cf, following the pow lowerings in the same pass, but I felt it
  was not necessary given the existing support for lowering scf to cf.
- Generalize the DenseMap storing op implementations: modify the callback
  function hashmap to be keyed by both OperationType (for me this effectively
  means the name of the op being implemented in software) and the type
  signature of the resulting function.
- Implement the ctlz function as a loop. I had researched a variety of
  implementations that claimed to be more efficient (such as those based on a
  de Bruijn sequence), but it seems to me that the simplest approach would make
  it easier for later compiler optimizations to do a better (platform-aware)
  job optimizing this than I could do by hand.

Questions I had for the reviewer:

- [edit: found mlir-cpu-runner and added two tests] What would I add to the filecheck invocation to actually run the resulting MLIR on a value and assert the output is correct? I have done this manually with the C implementation but I'm not confident my port to MLIR is correct.
- Should I add a test for a vectorized version of this lowering? I followed suit with the ` VecOpToScalarOp` but I admit I don't fully understand what it's doing.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D146261
2023-04-10 10:02:00 -07:00
Tue Ly
bc8e87ef4a [libc][math] Update range reduction step for logf and reduce its latency.
Simplify the range reduction steps by choosing the reduction constants
carefully so that the reduced arguments v = r*m_x - 1 and v^2 are exact in double
precision, even without FMA instructions, and -2^-8 <= v < 2^-7. This allows the
polynomial evaluations to be parallelized more efficiently.

Reviewed By: santoshn, zimmermann6

Differential Revision: https://reviews.llvm.org/D147755
2023-04-10 13:00:37 -04:00
Michael Jones
26f1770e53 [libc] clean up ctype negative handling
The ctype functions will sometimes be passed negative numbers, such as
EOF. Some of the previous implementations didn't handle these properly.
Additionally, the tests did not check any negative numbers. These
problems have been fixed.

This patch fixes https://github.com/llvm/llvm-project/issues/62000

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D147813
2023-04-10 10:00:22 -07:00
Aaron Ballman
711b70d77e Fix wording in a release note; NFC
This change happened due to post-commit feedback on the review.
2023-04-10 12:54:30 -04:00
Frederik Gossen
4a33c67995 Fix invalid op result access in SparseTensorCodegen
This trigges an assertion introduced in https://reviews.llvm.org/D147883

Differential Revision: https://reviews.llvm.org/D147950
2023-04-10 12:36:26 -04:00
Jay Foad
f34a1953ce [AMDGPU] Fix AddedComplexity for s_buffer_load patterns. NFCI.
We set AddedComplexity = 100 for s_load patterns to prefer them over
global loads, but for s_buffer_load patterns there is no need to do
this and it was quietly overriding the AddedComplexity of each
individual GCNPat that is defined inside SMLoad_Pattern (but in practice
that did not appear to make any difference).

Differential Revision: https://reviews.llvm.org/D145396
2023-04-10 17:26:50 +01:00
Bing1 Yu
87c1ed5385 Change dyn_cast to cast
Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D147923
2023-04-11 00:14:39 +08:00
Spenser Bauman
f7e1797580 [mlir][tosa] Lowering of tosa.gather operations with dynamic dimensions
The existing TOSA->Linalg lowering of tosa.gather only supports gathers
with either a static shape or a single dynamic batch dimension.
This change extends support to arbitrary number of dynamic dimensions on
both the values and indices of the gather operation.

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D147810
2023-04-10 15:56:57 +00:00
Valentin Clement
9343398708
[flang][NFC] Extract TypeConverter from header file
Extract the type converter definitions into its own .cpp
file so the type converter can be used by passes.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D147824
2023-04-10 08:41:07 -07:00
Corentin Jabot
1cdc0e83c8 [Clang] Check type-constraints applied to placeholder types
(and deduced return types)

Previously, only type constraints applied to type parameter
were semantically checked.

A diagnostic would still be emitted on instantiation, but it was
too late, lacked clarity, and was inconsistent with type parameters.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D147925
2023-04-10 17:33:09 +02:00
Alvin Wong
26c57df8aa [asan][test] Fix two test cases on Windows
Fixes global-location-nodebug and heavy_uar_test for both MSVC and MinGW
targets.

Differential Revision: https://reviews.llvm.org/D147445
2023-04-10 23:21:16 +08:00
Alvin Wong
a54b6b3318 [sanitizer][win] Fix Atexit() on MinGW asan_dynamic runtime
Some functions of asan depends on `Atexit()` handlers. On Windows, this
is implemented in ad3ec82bb1c7217b0187a1e16bb22642e194ce94 to queue the
handlers in a vector then register them with `atexit()` only after the
CRT is fully initialized. However, this is broken on MinGW with
asan_dynamic runtime due to different initialization order. This change
fixes the issue by making sure that `Atexit()` can call `atexit()`
directly past the pre-initialization phase.

This fixes two asan test cases on MinGW.

Differential Revision: https://reviews.llvm.org/D147413
2023-04-10 23:21:16 +08:00
Piotr Zegar
225d255a58 [clang-tidy] Added IgnoreVirtual option to misc-unused-parameters
Added option to ignore virtual methods in this check.
This allows to quickly get rid of big number of
potentialy false-positive issues without inserting
not-needed comments.

Fixes #55665.

Reviewed By: njames93

Differential Revision: https://reviews.llvm.org/D147918
2023-04-10 14:41:32 +00:00
Anna Thomas
27f8a62a54 [LoopPredication] Fix where we generate widened condition. PR61963
Loop predication's predicateLoopExit pass does two incorrect things:

It sinks the widenable call into the loop, thereby converting an invariant condition to a variant one
It widens the widenable call at a branch thereby converting the branch into a loop-varying one.

The latter is problematic when the branch may have been loop-invariant
and prior optimizations (such as indvars) may have relied on this
fact, and updated the deopt state accordingly.

Now, when we widen this with a loop-varying condition, the deopt state
is no longer correct.
https://github.com/llvm/llvm-project/issues/61963 fixed.

Differential Revision: https://reviews.llvm.org/D147662
2023-04-10 10:37:05 -04:00
Anna Thomas
975cc76020 Simplify test with deopt state in D147662. NFC 2023-04-10 10:37:04 -04:00
Jake Egan
3442aba806 [NFC][tests] Disable new gmodules-preferred-name-* tests on AIX and z/OS
Objective-C is not supported on AIX and z/OS. Precedent here: D109060
2023-04-10 09:51:02 -04:00
skc7
635c725b30 [AMDGPU][NFC] Regenerate test checks for merge-tbuffer.mir 2023-04-10 18:47:52 +05:30
Aaron Ballman
4624797f81 Fix the buildbots after 636dd1e8a1782e22f9bdee640428ed5c50a4a4f2
This addresses issues found by:
http://45.33.8.238/linux/103908/step_4.txt
https://lab.llvm.org/buildbot/#/builders/216/builds/19607
and others
2023-04-10 08:46:53 -04:00
Piotr Zegar
3defc3b707 [clang-tidy][NFC] Remove trailing spaces from ReleaseNotes.rst
Cleanup some trailing whitespaces from ReleaseNotes.rst
2023-04-10 12:43:11 +00:00
Aaron Ballman
636dd1e8a1 Make explicit the single-argument constructors of AttributeCommonInfo; NFC
The single-argument constructors of this class were not marked explicit
and that led to some incorrect uses that slipped under the radar (see
changes in SemaDeclAttr.cpp). This makes the constructors explicit,
changes the benignly incorrect uses, and updates the tablegen code to
emit the correct support code to call the explicit constructors.

While this does correct a misuse, that incorrect usage could not be
observed except via a debugger and so no additional tests are added.

Differential Revision: https://reviews.llvm.org/D147661
2023-04-10 08:29:21 -04:00
Shengchen Kan
55fc4f6b24 [TableGen] Fix compile fail when compiling llvm with MSVC due to typo in 931418667063 2023-04-10 20:23:37 +08:00
Florian Hahn
c255eb2c4b
[VPlan] Use VPLiveOut to update FOR live-out users.
Instead of iterating over all LCSSA phis in the exit block, collect all
LiveOut users of the FOR splice VPInstruction and only update those
users.

Building on top of D147471, this removes an access to the cost model
after VPlan execution.

Depends on D147471.

Reviewed By: Ayal, michaelmaitland

Differential Revision: https://reviews.llvm.org/D147472
2023-04-10 13:02:44 +01:00
Congcong Cai
72777dc000 [clang-tidy] avoid colon in namespace cause false positve
Refactor the Namespaces with NamespaceDecl[][].
First level stores non nested namepsace.
Second level stores nested namespace.

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D147893
2023-04-10 13:42:33 +02:00
mmarjano
f6e70ed1c7 [AMDGPU] Extend tbuffer_load_format merge
Add support for merging _IDXEN and _BOTHEN variants of
TBUFFER_LOAD_FORMAT instruction.
2023-04-10 12:24:21 +02:00
Vlad Serebrennikov
6737a15209 [clang] Mark CWG536 as N/A
[[https://wg21.link/p1787 | P1787]]: CWG536 (long partially resolved) is resolved by specifying that unqualified lookup occurs for any kind of unqualified-id as an id-expression.
Wording: An unqualified name is a name that <...>. Unless otherwise specified, such a name undergoes unqualified name lookup from the point where it appears. ([basic.lookup.unqual]/4)

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D147564
2023-04-10 13:18:19 +03:00
Piotr Zegar
01025ddd62 [clang-tidy][NFC] Rename test files for simplify-boolean-expr to match check name
Change simplify-bool-expr -> simplify-boolean-expr
2023-04-10 09:50:59 +00:00
Max Kazantsev
5b96b13fdf [SCEV] Improve AddRecs' range computation in Expensive Range Sharpening mode
Apply loop guards to AddRec's start in range computation for
non-self-wrapping AddRecs.

According to CT measurements, this has a wide negative compile time impact,
so we hold it in expensive range sharpening mode where it's not so critical.
However, we need to find a way to share benefits of this mode with default mode.

Patch by Aleksandr Popov!

Differential Revision: https://reviews.llvm.org/D147557
Reviewed By: mkazantsev
2023-04-10 16:37:10 +07:00
Luo, Yuanke
097b702546 [Coverity] avoid array overflow when use -1 as index. 2023-04-10 15:40:59 +08:00
Craig Topper
58dd265d25 [TableGen] Pass size to std::vector constructor instead of using resize. NFC 2023-04-10 00:17:41 -07:00
Craig Topper
551bfca86f [TableGen] Make TreePatternNode::InlinePatternFragments a static method. NFC
Previously we were passing 'this' and the std::shared_ptr version
of 'this'. This replaces all uses of 'this' with the shared_ptr and
makes the method static.
2023-04-10 00:17:29 -07:00
Craig Topper
2e6c72d341 [TableGen] Move vectors into DAGInstruction instead of copying them. NFC 2023-04-10 00:03:44 -07:00
Max Kazantsev
d0950d05a6 [NFC][IRCE] Do not store latch exit count
It is not actually used for any computations. Its only purpose is to
check that the loop is finite and find out the type of computed exit
count. Refactor code so that we only store this type.
2023-04-10 14:00:14 +07:00
skc7
b434051dc8 [AMDGPU] Introduce SIInstrWorklist to process instructions in moveToVALU
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D147168
2023-04-10 11:34:14 +05:30
Noah Goldstein
d65720652d [X86] Add inst fixup for unpckps -> unpckdq.
`unpckps` has the same performance as `unpckpd` (only port5) wereas
`unpckdq` can run on p15 on some newer architectures.

`unpckdq` is in the integer domain, so only do the transform if the
target has no bypass delay on shuffles (SKL+).

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D147729
2023-04-10 00:17:00 -05:00
Noah Goldstein
c3f01f13b1 [X86] Add inst fixup for unpckpd -> unpckqdq.
`unpckqdq` seems to be treated as a shuffle from bypass delay
perspective (which makes sense it appears to have shared shuffle units
for all micro-arch).

`unpckqdq` is slightly preferable to `shufpd` as it saves 1-byte of
code size and can be used to replace the micro-fused `rm` version. So,
if the target has no bypass delay, we should do `unpckpd` ->
`unpckqdq` instead of `shufpd.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D147728
2023-04-10 00:16:57 -05:00
Noah Goldstein
2ce1698a34 [X86] Fix perf bug in permilps -> shufd in X86FixupInstTuning.
We shouldn't do the transformation if we either have bypass delay OR
the new opcode has worse performance. Previous code was incorrectly
using AND.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D147727
2023-04-10 00:16:54 -05:00
Noah Goldstein
e2f6527690 [X86] Improve inst tuning tests for X86FixupInstTuning Pass; NFC
1) Add tests for `unpckps`.
2) Add explicit test for fast shuffles (ICX+) but WITH bypass delay.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D147726
2023-04-10 00:16:48 -05:00
Chen Zheng
bc257ff07b [GlobalISelEmitter] add case for D141247, NFC. 2023-04-10 01:11:26 -04:00
Mehdi Amini
e08af17073 Revert "[MLIR] Add an assert in Operation::getOpResultImpl for out of range result"
This reverts commit 13b21971fbf5cd47dc3acb0c593aae8ae980c8d8.
Multiple bots are broken.
2023-04-09 21:21:56 -07:00