473697 Commits

Author SHA1 Message Date
Kito Cheng
af9b25f9db [RISCV] Optimize floating point scalar move and splat
In D158086, we limit all floating point scalar move and splat can't fuse
vsetvli with different SEW, and this patch try to relax the constraint
as possible by introducing new SEW demand type:
SEWGreaterThanOrEqualAndLessThan64, that allow SEW fused with larger
SEW, but constraint it can't fused with SEW=64.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D158177
2023-09-06 16:39:30 +08:00
Guillaume Chatelet
b793c7e530
[libc][NFC] split type_traits / utility in separate files (#65314)
`type_traits` and `utility` refer to each other in their
implementations. Also `type_traits` starts to become too big to be
manageable. This PR splits each function into individual files. FTR this
is [how libcxx handles large headers as
well](https://github.com/llvm/llvm-project/tree/main/libcxx/include/__type_traits).
2023-09-06 10:31:08 +02:00
Guillaume Chatelet
56426c6cdf
[libc] customizable namespace 1/4 (#65321)
This implements the first step of
https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079

Make required Bazel and CMake preparatory changes which define the var
for the customizable namespace and use it (pass it as a compile option
-DLIBC_NAMESPACE=<...>).

Differential Revision: https://reviews.llvm.org/D159112
2023-09-06 10:27:56 +02:00
martinboehme
c0703eaec1
[clang][dataflow] Emit an error if source code is not compiled as C++. (#65301)
The shape of certain elements of the AST can vary depending on the
langugage.
We currently only support C++.
2023-09-06 10:02:21 +02:00
martinboehme
be12f26dc0
[clang][dataflow][NFC] Remove stale comment. (#65322) 2023-09-06 09:52:30 +02:00
David Spickett
6c3232b515
[lldb][Docs] Add simpler "automatic" cross-compile option to build docs (#65311)
The main way I cross build lldb is to point CMake at an existing host
build to get the native tablegen tools. This is what we had documented
before.

There is another option where you start from scratch and the host tools
are built for you. This patch documents that and explains which one to
choose.

Added another arm64 example which uses this. So the frst one is the
"automatic" build and the second is the traditional approach.

For ease of copy paste and understanding, I've kept the full command in
each section and noted the one difference between them.

Along the way I updated some of the preamble to explain the two
approaches and updated some language e.g. removing "just ...". Eveyone's
"just" is different, doubly so when cross-compiling.
2023-09-06 08:48:19 +01:00
martinboehme
f470c361d9
[clang][dataflow] Eliminate uses of RecordValue::getChild(). (#65329)
We want to work towards eliminating the `RecordStorageLocation` from
`RecordValue`. These particular uses of `RecordValue::getChild()` can
simply
be replaced with `RecordStorageLocation::getChild()`.
2023-09-06 09:43:05 +02:00
Sergei Barannikov
a479be0f39 [MC] Change tryParseRegister to return ParseStatus (NFC)
This finishes the work of replacing OperandMatchResultTy with
ParseStatus, started in D154101.
As a drive-by change, rename some RegNo variables to just Reg
(a leftover from the days when RegNo had 'unsigned' type).
2023-09-06 10:28:12 +03:00
Ingo Müller
ca23c933bd [mlir][python] Create all missing attribute builders.
This patch adds attribute builders for all buildable attributes from the
builtin dialect that did not previously have any. These builders can be
used to construct attributes of a particular type identified by a string
from a Python argument without knowing the details of how to pass that
Python argument to the attribute constructor. This is used, for example,
in the generated code of the Python bindings of ops.

The list of "all" attributes was produced with:

(
  grep -h "ods_ir.AttrBuilder.get" $(find ../build/ -name "*_ops_gen.py") \
    | cut -f2 -d"'"
  git grep -ho "^def [a-zA-Z0-9_]*" -- include/mlir/IR/CommonAttrConstraints.td \
    | cut -f2 -d" "
) | sort -u

Then, I only retained those that had an occurence in
`mlir/include/mlir/IR`. In particular, this drops many dialect-specific
attributes; registering those builders is something that those dialects
should do. Finally, I removed those attrbiutes that had a match in
`mlir/python/mlir/ir.py` already and implemented the remaining ones. The
only ones that still miss a builder now are the following:

* Represent more than one possible attribute type:
  - `Any.*Attr` (9x)
  - `IntNonNegative`
  - `IntPositive`
  - `IsNullAttr`
  - `ElementsAttr`
* I am not sure what "constant attributes" are:
  - `ConstBoolAttrFalse`
  - `ConstBoolAttrTrue`
  - `ConstUnitAttr`
* `Location` not exposed by Python bindings:
  - `LocationArrayAttr`
  - `LocationAttr`
* `get` function not implemented in Python bindings:
  - `StringElementsAttr`

This patch also fixes a compilation problem with
`I64SmallVectorArrayAttr`.

Reviewed By: makslevental, rkayaith

Differential Revision: https://reviews.llvm.org/D159403
2023-09-06 07:09:25 +00:00
jeanPerier
d26c78b2ad
[flang] handle indirect module variable use in internal procedure (#65324)
When a module variable is referenced inside an internal procedure, but
the use statement for the module is inside the host, semantics may not
create any symbols with HostAssocDetails directly under the internal
procedure scope.
So pft::getScopeVariableList, that is called in the bridge when lowering
the internal procedure scope, failed to instantiate the module
variables. This lead to "symbol is not mapped to any IR value" compile
time errors.

This patch fixes the issue by adding the variables to the list of
"captured" global variables from the host program, so that they are
instantiated as part of the `internalProcedureBindings` in the bridge.

The rational of doing it that way instead of changing
`getScopeVariableList` is that `getScopeVariableList` would have to
import all the module variables used inside the host since it cannot
know which ones are referenced inside the internal procedure from the
semantics::Scope information. The fix in this patch only instantiates
the module variables from the host that are actually referenced inside
the internal procedure.
2023-09-06 09:07:45 +02:00
Tobias Gysi
0c81e6dd91
[mlir][llvm] Add icmp folder (#65343)
This revision adds a simple icmp folder that performs the following
folds to the LLVM dialect icmp op:
 - cmpi(eq/ne, x, x) -> true/false
 - cmpi(eq/ne, alloca, null) -> false/true
 - cmpi(eq/ne, null, alloca) -> cmpi(eq/ne, alloca, null)
2023-09-06 08:58:39 +02:00
laichunfeng
71b5f57f0d [RISCV] Adjust first sp size to use c.addi16sp.
addi sp, sp, 512 may be used to recover the sp in the epilogue
when stack size is larger than 2047(2^11 - 1), however, it can
not be compressed using C extension, and addi sp, sp, 496 is
able to be compressed, so try to use 496 as the ajust amount of
the fisrt sp if function doesn't need extra instructions after
adjust.

Reviewed By: wangpc

Differential Revision: https://reviews.llvm.org/D159431
2023-09-06 14:26:52 +08:00
Sergei Barannikov
9ddcacce08 [Sparc] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
  return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
  Error(L, "msg");
  return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.

Reviewed By: brad

Differential Revision: https://reviews.llvm.org/D154321
2023-09-06 09:22:34 +03:00
Guray Ozen
1dc0071216 [MLIR] Guard Cuda 12.0+ newer driver APIs with CUDA_VERSION macro checks
Fixes #64529
https://github.com/llvm/llvm-project/issues/64529

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D159440
2023-09-06 08:17:06 +02:00
Ting Wang
71be020dda [SelectionDAG][PowerPC] Memset reuse vector element for tail store
On PPC there are instructions to store element from vector(e.g.
stxsdx/stxsiwx), and these instructions can be leveraged to avoid tail
constant in memset and constant splat array initialization.

This patch tries to explore these opportunities.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D138883
2023-09-06 01:52:38 -04:00
Marek Sedláček
ebf01690d9 Bug fix for multi-line labels in CFG dot graph
After D154102 multi-line labels would get split incorrectly.
When CFG is generated for a function with basic block name longer
than 80 lines, then the header separator will be placed after the
line break for the label name instead of after the whole label name.
The fix is simple by just moving the insert of | character before the
line splitting happens.

Differential Revision: https://reviews.llvm.org/D159207
2023-09-05 22:01:51 -07:00
Trung Nguyen
976dbae246 [libunwind] Haiku: Initial support
Adds build support for Haiku.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D157866
2023-09-06 00:56:09 -04:00
Pravin Jagtap
b230472f22
[AMDGPU] Extend v2i16 & v2f16 support for llvm.amdgcn.update.dpp intr (#65318)
Authored-by: Pravin Jagtap <Pravin.Jagtap@amd.com>
2023-09-06 10:20:34 +05:30
Craig Topper
2a7b8ab07c
[RISCV] Use add.uw for (or (and X, 0xFFFFFFFF), Y) if Y has zeroes in the lower 32 bits. (#65402) 2023-09-05 21:05:53 -07:00
Michael Maitland
5b7982f2b2
[RISCV] Fix SiFive7 formula for Reductions and ordered Reductions (#65385)
Reductions specified the correct formula in the comments but was
implemented incorrectly.

Ordered reductions formula was refined to be more accurate to actual
hardware.

A llvm-mca test case for reductions is added so that we have a better
idea of how the model is performing.
2023-09-05 23:04:21 -04:00
Ed Maste
43d05f4cc9
[libc++] Switch FreeBSD CI job to Clang 16 (#65422)
libc++ will drop support for Clang 15 before long.
2023-09-05 22:07:28 -04:00
Jie Fu
1438544e23 [DFSAN] Silence parameter 'va_labels' set but not used warning (NFC)
/data/llvm-project/compiler-rt/lib/dfsan/dfsan_custom.cpp:2546:37: error: parameter 'va_labels' set but not used [-Werror,-Wunused-but-set-parameter]
                       dfsan_label *va_labels, dfsan_label *ret_label,
                                    ^
1 error generated.
2023-09-06 09:28:43 +08:00
Tomasz Kuchta
8dbcf8eba7 [DFSAN] Add support for sscanf.
Reviewed By: browneee

Differential Revision: https://reviews.llvm.org/D153775
2023-09-06 01:16:31 +00:00
Chris Bieneman
400d3261a0 [HLSL] Cleanup support for this as an l-value
The goal of this change is to clean up some of the code surrounding
HLSL using CXXThisExpr as a non-pointer l-value. This change cleans up
a bunch of assumptions and inconsistencies around how the type of
`this` is handled through the AST and code generation.

This change is be mostly NFC for HLSL, and completely NFC for other
language modes.

This change introduces a new member to query for the this object's type
and seeks to clarify the normal usages of the this type.

With the introudction of HLSL to clang, CXXThisExpr may now be an
l-value and behave like a reference type rather than C++'s normal
method of it being an r-value of pointer type.

With this change there are now three ways in which a caller might need
to query the type of `this`:

* The type of the `CXXThisExpr`
* The type of the object `this` referrs to
* The type of the implicit (or explicit) `this` argument

This change codifies those three ways you may need to query
respectively as:

* CXXMethodDecl::getThisType()
* CXXMethodDecl::getThisObjectType()
* CXXMethodDecl::getThisArgType()

This change then revisits all uses of `getThisType()`, and in cases
where the only use was to resolve the pointee type, it replaces the
call with `getThisObjectType()`. In other cases it evaluates whether
the desired returned type is the type of the `this` expr, or the type
of the `this` function argument. The `this` expr type is used for
creating additional expr AST nodes and for member lookup, while the
argument type is used mostly for code generation.

Additionally some cases that used `getThisType` in simple queries could
be substituted for `getThisObjectType`. Since `getThisType` is
implemented in terms of `getThisObjectType` calling the later should be
more efficient if the former isn't needed.

Reviewed By: aaron.ballman, bogner

Differential Revision: https://reviews.llvm.org/D159247
2023-09-05 19:38:50 -05:00
LLVM GN Syncbot
68e94f1f27 [gn build] Port 065dc485bd4b 2023-09-06 00:01:57 +00:00
Nico Weber
d50b56d18c [gn] port fbdf684fae52 2023-09-05 20:01:17 -04:00
Greg Clayton
d4a141ef93 Switch over to using the LLVM archive parser for BSD archives.
Our LLDB parser didn't correctly handle archives of all flavors on different systems, it currently only correctly handled BSD archives, normal and thin, on macOS, but I noticed that it was getting incorrect information when decoding a variety of archives on linux. There were subtle changes to how names were encoded that we didn't handle correctly and we also didn't set the result of GetObjectSize() correctly as there was some bad math. This didn't matter when exracting .o files from .a files for LLDB because the size was always way too big, but it was big enough to at least read enough bytes for each object within the archive.

This patch does the following:
- switch over to use LLVM's archive parser and avoids previous code duplication
- remove values from ObjectContainerBSDArchive::Object that we don't use like:
  - uid
  - gid
  - mode
- fix ths ObjectContainerBSDArchive::Object::file_size value to be correct
- adds tests to test that we get the correct module specifications

Differential Revision: https://reviews.llvm.org/D159408
2023-09-05 16:54:05 -07:00
Jonas Devlieghere
511b4dd928
[llvm] Add LLVM_CTOR_NODISCARD to WithColor
Similarly to WithMarkup, add LLVM_CTOR_NODISCARD to the WithColor
constructor.
2023-09-05 16:47:41 -07:00
Jonas Devlieghere
11ce3d99b7
[llvm] Add LLVM_CTOR_NODISCARD (#65418)
[[nodiscard]] on constructors is a defect report against C++17. That
means that it should be applied retroactively, though older compilers
might not know about it and emit warnings. This adds a
back-compatibility macro.
2023-09-05 16:47:04 -07:00
Jakub Mazurkiewicz
065dc485bd [libc++][ranges] Implement P2443R1: views::chunk_by
This patch implements https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2443r1.html (`views::chunk_by`).

Reviewed By: #libc, var-const

Differential Revision: https://reviews.llvm.org/D144767
2023-09-05 16:19:49 -07:00
Bill Wendling
3e19b10b02 Partial revert of b0cbf3a0dac5
The headers are needed.
2023-09-05 16:18:20 -07:00
Artem Belevich
2a702eca3e Use unsigned types for __popc/__popcll to match their declarations in CUDA headers.
https://github.com/llvm/llvm-project/issues/65250
2023-09-05 16:02:42 -07:00
Derek Schuff
5458736b71
Add a GitHub team to subscribe to WebAssembly backend (#65419)
This also includes some files related to the Wasm binary and object file
format (which is technically distinct from the WebAssembly architecture,
but practically inseparable).
2023-09-05 16:00:12 -07:00
varconst
390ac82317 [libc++][ranges] Add benchmarks for the from_range constructors of vector and deque.
Differential Revision: https://reviews.llvm.org/D150747
2023-09-05 15:57:45 -07:00
Matt Arsenault
695c59c4a2
Add amdgpu paths to CODEOWNERS (#65229) 2023-09-05 18:46:22 -04:00
Fangrui Song
28b4155c87 [docs] Mention that function multi-versioning using target_version is also fixed 2023-09-05 15:05:11 -07:00
Mogball
aa2adc1283 [mlir][index] Fix side effect modeling for division by zero ops
Operations that can divide by zero and can have immediate undefined
behaviour should be marked as `NoMemoryEffect` rather than `Pure`.

Depends on D159456

Reviewed By: weiweichen

Differential Revision: https://reviews.llvm.org/D159457
2023-09-05 21:45:28 +00:00
Mogball
b3a5f5394f [mlir] Add empty to StringAttr
It was common to see `value.getValue().empty()` or `value.size()`
instead of the idiomatic `value.empty()`.

Depends on D159455

Differential Revision: https://reviews.llvm.org/D159456
2023-09-05 21:45:27 +00:00
Mogball
8e3883a43b [mlir][ub] Fix typo in ub.poison op documentation (NFC)
Differential Revision: https://reviews.llvm.org/D159455
2023-09-05 21:45:25 +00:00
Carlo Bramini
17f747b304 [polly] Dynamic libraries are not supported on Cygwin
Cygwin shares the same limitations as traditional Windows executables
for dynamic library loading, so disable building the dynamic library on
Cygwin targets.

Differential Revision: https://reviews.llvm.org/D155796
2023-09-05 14:38:35 -07:00
Joel E. Denny
efec733bf5 Revert "[lit] Echo full RUN lines in case of external shells"
Buildbots failed after this landed, as reported at:

<https://github.com/llvm/llvm-project/pull/65267#issuecomment-1707318337>

This reverts commit 9191ba7144b39f5af699993d66f3587d5da49759.
2023-09-05 17:20:21 -04:00
Mehdi Amini
5d7b2bfe99
Add a GitHub team to subscribe to changes to MLIR Presburger library (#65294) 2023-09-05 14:08:10 -07:00
Matt Arsenault
a4a72bccac
Add regalloc team to CODEOWNERS (#65208)
Probably missed some cases. We also probably should rename the ML stuff
to use a consistent capitalization scheme
2023-09-05 16:53:05 -04:00
Alexander Richardson
eade41c453
[UpdateTestChecks] Add @llvm/pr-subscribers-testing-tools to CODEOWNERS (#65338) 2023-09-05 21:36:57 +01:00
Kazu Hirata
2f0153a756 [SelectionDAG] Remove deprecated getLoad, getStore, etc
These functions have been deprecated since:

  commit 8b1d86aedf13a22e283ee334304063febdaec9c7
  Author: Guillaume Chatelet <gchatelet@google.com>
  Date:   Mon Jan 23 10:08:01 2023 +0000

  commit 355cc3fd8c63f4bddfd328f62c2d9413f492a7fd
  Author: Guillaume Chatelet <gchatelet@google.com>
  Date:   Tue Jan 24 10:39:58 2023 +0000

Differential Revision: https://reviews.llvm.org/D159448
2023-09-05 13:34:55 -07:00
Heejin Ahn
666098c5b3 [Headers] Remove musl-related comment about NULL
This removes a comment added in D159312, which warned people to not
re-add a whitespace in the `((void*)0))` expression. After discussions
happened in D159312, it doesn't seem like a permanent solution.

While I'd like to keep the whitespace removed for now, given that at
least it can be a band-aid to some users who use musl and clang's
`stddef.h` at the same time, it seems the usage of them together is not
something that's officially supported, and I should not be implying this
should be the permanent solution by saying so in the comments.

Reviewed By: aaron.ballman, ributzka

Differential Revision: https://reviews.llvm.org/D159383
2023-09-05 13:29:02 -07:00
Jan Svoboda
e76d4fddcb [clang][arcmt] NFCI: Change invocation const-ness 2023-09-05 13:23:54 -07:00
Jan Svoboda
8e0c9bb91f [clang] NFCI: Change returned AnalyzerOptions smart pointer to reference 2023-09-05 13:23:53 -07:00
Jan Svoboda
5746002ebb [clang] NFCI: Change returned LanguageOptions pointer to reference 2023-09-05 13:23:53 -07:00
Bill Wendling
b0cbf3a0da [NFC] remove unneded header includes
This time from clang/Parse.

Differential Revision: https://reviews.llvm.org/D159435
2023-09-05 13:12:01 -07:00