459572 Commits

Author SHA1 Message Date
Craig Topper
fa42e7b6bc [RISCV] Merge RISCV::parseCPUKind and RISCV::checkCPUKind.
Similar for RISCV::parseTuneCPU and RISCV::checkTuneCPUKind.

This makes the CPUKind enum no longer part of the API. It wasn't
providing much value. It was only used to pass between the two
functions.

By removing it, we can remove a dependency on a tablegen generated
file from the RISCVTargetParser.h file. Then we can remove a
dependency from several CMakeLists.txt.
2023-05-01 13:00:05 -07:00
Arthur Eubanks
578a4716f5 Reland [clang] Canonicalize system headers in dependency file when -canonical-prefixes
Clang was writing paths to the dependency file that don't exist when using a sysroot with symlinks, causing everything to get rebuilt every time. This is reproducible on Linux by creating a symlink to '/', using that as the sysroot, and trying to build something with ninja that includes the C++ stdlib (e.g. a typical build of LLVM).

This fixes https://github.com/ninja-build/ninja/issues/1330 and somewhat matches gcc.

gcc canonicalizes system headers in dependency files under a -f[no-]canonical-system-headers, but it makes more sense to look at -canonical-prefixes.

D37954 was a previous attempt at this.

Fixed use of %T instead of %t in test, causing bots to fail the test on the initial commit.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D149187
2023-05-01 12:44:52 -07:00
Nikolas Klauser
17a8e24570 [libc++][PSTL] Remove _PSTL_HIDE_FROM_ABI_{PUSH,POP} macros
Reviewed By: ldionne, #libc

Spies: libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D149556
2023-05-01 12:41:30 -07:00
LLVM GN Syncbot
5a49fee329 [gn build] Port 13fe6733019a 2023-05-01 19:12:51 +00:00
Craig Topper
13fe673301 [RISCV] Move NTLH hint emission into RISCVAsmPrinter.cpp.
Rather than having a separate pass to add the hint instructions,
emit them directly into the streamer during asm printing.

Reviewed By: BeMg, kito-cheng

Differential Revision: https://reviews.llvm.org/D149511
2023-05-01 12:05:18 -07:00
Peiming Liu
4ca1932776 [mlir][sparse] fix compiler warning in release build.
Differential Revision: https://reviews.llvm.org/D149607
2023-05-01 19:02:43 +00:00
LLVM GN Syncbot
9809eb32a4 [gn build] Port a595b931f1f9 2023-05-01 18:48:32 +00:00
Ian Anderson
a595b931f1 [libc++] cuchar redeclares ::mbstate_t when it's in its own clang module
When cuchar is compiled independently on platforms that don't have <uchar.h>, it doesn't get a declaration of mbstate_t, and so makes an empty declaration for ::mbstate_t. That conflicts with the declarations in __mbstate_t.h and cwchar since both of those headers do get mbstate_t before making ::mbstate_t.

Change `__mbstate_t.h` to just get the underlying declaration for mbstate_t and not make a declaration for ::mbstate_t. Include __mbstate_t.h in uchar.h and wchar.h when their next headers aren't available so that at least mbstate_t gets defined.

Add __std_mbstate_t.h to declare ::mbstate_t for headers that need that when cuchar or cwchar aren't available (because either _LIBCPP_HAS_NO_WIDE_CHARACTERS or _LIBCPP_CXX03_LANG).

Reviewed By: ldionne, Mordante, #libc, philnik

Differential Revision: https://reviews.llvm.org/D148542
2023-05-01 13:48:20 -05:00
Jakub Kuderski
7f3b0e5845 [mlir][arith] Add narrowing patterns to commute more vector ops
This commutes the extension (`arith.extsi`, `arith.extui`) over the
following vector ops: `vector.broadcast`, `vector.shape_cast`,
`vector.transpose`, `vector.flat_transpose`.

I focused on these as I saw them getting created by vector unroll
patterns. Maybe except `vector.flat_transpose`.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149534
2023-05-01 14:32:57 -04:00
Jakub Kuderski
3ff870881f [mlir][arith] Add narrowing patterns for other insertion ops
Allow to commute extension ops over `vector.insertelement` and
`vector.insert_strided_slice`.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149509
2023-05-01 14:29:02 -04:00
Valentin Clement
0f1a8b458d
[flang][openacc][NFC] Fix typos segement -> segment 2023-05-01 11:28:20 -07:00
Noah Goldstein
358cdb4489 Revert "[ValueTracking] Use knownbits interface for determining if div/rem are safe to speculate"
Appears to be causing out-of-tree test failures. Reverting while the
issue is investigated.

This reverts commit fbc7fcf5ae26fad7db3e7c861fc6447e02b39cf0.
2023-05-01 13:20:09 -05:00
Peiming Liu
d4db528938 [mlir][sparse] extend unpack operation to support unpacking a batched COO type
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D149103
2023-05-01 18:17:29 +00:00
Arthur Eubanks
f9fbda7102 Revert "[clang] Canonicalize system headers in dependency file when -canonical-prefixes"
This reverts commit 8f0dd4ef3ed2137d1e2554204127434fc46ee190.

Causes bot failures: https://lab.llvm.org/buildbot/#builders/139/builds/39964
2023-05-01 10:55:53 -07:00
Philip Reames
30cdb2ac7e [LAA] Add command line flag to disable unit stride speculation
This is purely so that we can expose and work through downstream codegen issues.  My intention is to see if we can get this disabled by default, but that requires fixing a bunch of downstream issues first.
2023-05-01 10:49:51 -07:00
Arthur Eubanks
8f0dd4ef3e [clang] Canonicalize system headers in dependency file when -canonical-prefixes
Clang was writing paths to the dependency file that don't exist when using a sysroot with symlinks, causing everything to get rebuilt every time. This is reproducible on Linux by creating a symlink to '/', using that as the sysroot, and trying to build something with ninja that includes the C++ stdlib (e.g. a typical build of LLVM).

This fixes https://github.com/ninja-build/ninja/issues/1330 and somewhat matches gcc.

gcc canonicalizes system headers in dependency files under a -f[no-]canonical-system-headers, but it makes more sense to look at -canonical-prefixes.

D37954 was a previous attempt at this.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D149187
2023-05-01 10:40:18 -07:00
Jakub Kuderski
49df068836 [mlir][arith][NFC] Simplify narrowing patterns with a wrapper type
Add a new wraper type that represents either of `ExtSIOp` or `ExtUIOp`.
This is to simplify the code by using a single type, so that we do not
have to use templates or branching to handle both extension kinds.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149485
2023-05-01 13:31:31 -04:00
Alan Zhao
f762798599 Fix ReleaseNotes.rst unresolved merge conflict 2023-05-01 10:26:15 -07:00
Douglas Yung
c46d9af26c Revert "Host: generalise GetXcodeSDKPath"
This reverts commit ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9.

This breaks the build with GCC and affects at least 2 build bots:
https://lab.llvm.org/buildbot/#/builders/217/builds/20568
https://lab.llvm.org/buildbot/#/builders/243/builds/5576
2023-05-01 10:22:53 -07:00
Philip Reames
4343534a67 [LAA] Rework overflow checking in getPtrStride [nfc]
The previous code structure and comments were exceedingly confusing.  I have multiple times looked at this code and suspected a bug.  This time, I decided to take the time to reflow the code and comment out why it is correct.

The only suspect (to me) case left is that an underaligned access with a unit stride (in terms of the access type) might miss the undefined null pointer when wrapping.  This is unlikely to be an issue for C/C++ code with real page sizes, so I'm not bothering to fully convince myself whether that case is correct or not.
2023-05-01 10:21:02 -07:00
William Huang
d38d6ca179 [llvm-profdata] Deprecate Compact Binary Sample Profile Format
Remove support for compact binary sample profile format

Reviewed By: davidxl, wenlei

Differential Revision: https://reviews.llvm.org/D149400
2023-05-01 17:10:08 +00:00
Alan Zhao
9b4faa11c6 [clang] Fix overly aggressive lifetime checks for parenthesized aggregate initialization
Before this patch, initialized class members would have the LifetimeKind
LK_MemInitializer, which does not allow for binding a temporary to a
reference. Binding to a temporary however is allowed in parenthesized
aggregate initialization, even if it leads to a dangling reference. To
fix this, we create a new EntityKind, EK_ParenAggInitMember, which has
LifetimeKind LK_FullExpression.

This patch does *not* attempt to diagnose dangling references as a
result of using this feature.

This patch also refactors TryOrBuildParenListInitialization(...) to
accomodate creating different InitializedEntity objects.

Fixes #61567

[0]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html

Reviewed By: shafik

Differential Revision: https://reviews.llvm.org/D148274
2023-05-01 10:02:15 -07:00
Slava Zakharin
266d65c98a [flang][hlfir] Fixed boxchar variables emboxing.
We have to unbox the boxchar variables in order to get to
the raw address that can be used for emboxing.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D149473
2023-05-01 09:53:49 -07:00
Slava Zakharin
57e38bc6c8 [flang][hlfir] Fixed lowering for optional dummy.
We have to keep it as a box, since taking box_addr of the optional
box may be invalid.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D149505
2023-05-01 09:53:14 -07:00
Yingwei Zheng
6d667d4b26
[InstCombine] Combine const GEP chains
This patch reverts rGae739aefd7473517d3f08b5c8d08a66c7f469198 to address performance regressions reported by our [CI](https://github.com/dtcxzyw/llvm-ci/issues/137) after rG2ec1d0f427c7822540352c0c14d057e7bfe4f77b.

For example:
```
define ptr @const_gep_chain(ptr %p, i64 %a) {
    %p1 = getelementptr inbounds i8, ptr %p, i64 %a
    %p2 = getelementptr inbounds i8, ptr %p1, i64 1
    %p3 = getelementptr inbounds i8, ptr %p2, i64 2
    %p4 = getelementptr inbounds i8, ptr %p3, i64 3
    ret ptr %p4
}
```
The last three GEPs will not be folded since rG2ec1d0f427c7822540352c0c14d057e7bfe4f77b.

I think it is appropriate to remove this code because there is no compile-time regression reported in our benchmarks.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D149240
2023-05-02 00:28:39 +08:00
Alan Zhao
da0089c99b [clang] Fix default initializers being ignored when initializing templated aggregate types
Previously, when checking whether an in-class initializer exists when
performing parenthesized aggregate initialization, Clang checks that the
output of FieldDecl::getInClassInitializer() is non-null. This is
incorrect; if the field is part of a templated type, then
getInClassInitializer() will return nullptr if we haven't called
Sem::BuildCXXDefaultInitExpr(...) before, even if
FieldDecl::hasInClassInitializer() returns true. The end result is that
Clang incorrectly ignores the in class initializer and
value-initializes the field. The fix therefore is to instead call
FieldDecl::hasInClassInitializer(), which is what we do for braced init
lists [0].

Before this patch, Clang does correctly recognize the in-class field
initializer in certain cases. This is Sema::BuildCXXDefaultInitExpr(...)
populates the in class initializer of the corresponding FieldDecl
object. Therefore, if that method was previously called with the same
FieldDecl object, as can happen with a decltype(...) or a braced list
initialization, FieldDecl::getInClassInitializer() will return a
non-null expression, and the field becomes properly initialized.

Fixes 62266

[0]: be5f35e24f/clang/lib/Sema/SemaInit.cpp (L685)

Reviewed By: shafik

Differential Revision: https://reviews.llvm.org/D149389
2023-05-01 09:27:52 -07:00
LLVM GN Syncbot
ce357fd4ee [gn build] Port 824391693cbb 2023-05-01 16:04:47 +00:00
Nikolas Klauser
824391693c [libc++][PSTL] Implement std::find{,_if,_if_not}
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D149539
2023-05-01 09:04:29 -07:00
Philip Reames
89a44b0fae [LAA] Use early return [nfc] 2023-05-01 08:35:56 -07:00
Muiez Ahmed
6cd3343b4a [SystemZ][z/OS] Mark ecsymbols test as unsupported
The llvm-lib tool is not yet supported on z/OS.

Differential Revision: https://reviews.llvm.org/D149591
2023-05-01 11:26:25 -04:00
Zarko Todorovski
99fe4d3826 Set EnableAIXExtendedAltivecABI in BackendUtils from LangOpts
Fix a bug where after
github.com/llvm/llvm-project/commit/68dd51421f16f1e17cd453cb1730fcca99a6cfb7
refactor where we are not passing -mabi=vec-extabi to th backend.
2023-05-01 10:39:14 -04:00
Philip Reames
faa43a80f7 [RISCV] Rewrite isLegalElementTypeForRVV in terms of ValueTypes [nfc]
This was briefly mentioned as a possibility in review discussion on D149369.

One slightly surprising bit to call out - these interfaces can get invoked with non-vector typed arguments. LoopVectorizer likes to call the costing interfaces with scalar types when unrolling, but not vectorizing. I found that surprising, not sure if others do.

Differential Revision: https://reviews.llvm.org/D149462
2023-05-01 07:37:40 -07:00
Florian Hahn
6303fa369c
[VPlan] Remove DeadInsts arg from VPInstructionsToVPRecipes (NFC)
The argument isn't used. VPlan-based dead recipe removal can be used
instead.
2023-05-01 15:03:29 +01:00
Louis Dionne
faa78ecd27 [clang] Temporarily enable debug output when uploading artifacts during CI jobs
This is an attempt to troubleshoot our excessive usage of network in
Clang jobs on Buildkite.
2023-05-01 09:48:14 -04:00
Doru Bercea
a91cb9ce39 Emit info message when use_device_address variable does not have a device counterpart. 2023-05-01 09:07:48 -04:00
Aaron Ballman
ea3a870032 Fix the clang sphinx bot
Addresses the issue found in:
https://lab.llvm.org/buildbot/#/builders/92/builds/43478
2023-05-01 07:31:03 -04:00
Christian Sigg
896af9e48d [bazel] Fix layering check after 0610e2f
`BytecodeWriter.h` is now included in `IR.h`, and the corresponding dependency should be moved to `header_deps`. This change fixes Google's internal build, which seems to have a stricter layering check than bazel's, but it's still the right thing to do.

Differential Revision: https://reviews.llvm.org/D149576
2023-05-01 12:46:39 +02:00
Kadir Cetinkaya
5e74a3dc2d
[clangd][IncludeCleaner] Use a proper comparator for deduplicating findings
Previous one didn't have strict weak ordering guarantees.
2023-05-01 12:19:33 +02:00
Advenam Tacet
6875424135 [compiler-rt][ASan] Fix description of __sanitizer_annotate_contiguous_container
This revision updates the description of
`__sanitizer_annotate_contiguous_container` in includes. Possibilites of
the function were changed in D132522 and it supports:
  - unaligned beginning,
  - shared first/last granule with other objects.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149341
2023-04-30 22:21:12 -07:00
Jacques Pienaar
5c90e1ffb0 [mlir][bytecode] Return error instead of min version
Can't return a well-formed IR output while enabling version to be bumped
up during emission. Previously it would return min version but
potentially invalid IR which was confusing, instead make it return
error and abort immediately instead.

Differential Revision: https://reviews.llvm.org/D149569
2023-04-30 22:11:02 -07:00
Vitaly Buka
fddd28364c [test][HWASAN] Auto-generate a few tests 2023-04-30 22:06:52 -07:00
Vitaly Buka
e8893133d1 Revert "[NFC][HWASAN] Handle tags as Int8"
More tests need updates.

This reverts commit e876ba5db98830db427395ed9b3718d20bf519fb.
2023-04-30 20:59:43 -07:00
Shilei Tian
fb53a7044a [OpenMP] Only enable version script if supported
The linker flag `--version-script` may not be supported by all linkers, such as
macOS's linker. `libomp` is already capable of detecting whether the linker supports
it and append the linker flag accordingly. Since currently we assume `libomptarget`
only works on Linux, we don't do the check accordingly. This patch simply adds
the check before adding it to linker flag. This will be the first patch to make
OpenMP target offloading work on macOS. Note that CMake files in `plugins` are
not touched before they are going to be removed pretty soon anyway.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D149555
2023-04-30 23:34:56 -04:00
Vitaly Buka
e876ba5db9 [NFC][HWASAN] Handle tags as Int8 2023-04-30 19:58:01 -07:00
Vitaly Buka
0b97aff4d2 [NFC][HWASAN] Rename local variable 2023-04-30 19:49:25 -07:00
Tim Schmielau
85ed0fb503 Basic documentation of -mrecip=... option
The documentation is still rather terse because it needs to fit
onto a single line of clang --help output.
But at least it lists what the user can specify and documents the
non-obvious syntax.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D149456
2023-05-01 07:43:00 +05:30
Vitaly Buka
f42f863c33 [NFC][HWASAN] Set constant type from another operand 2023-04-30 19:07:57 -07:00
Vitaly Buka
6001d8a28b [test][HWASAN] Remove update_test_checks note
This test is not autogenerated.
2023-04-30 18:45:31 -07:00
Vitaly Buka
37f6c9f852 [HWASAN] Untag before tagging alloca pointers
This is folloup to b5595836, which missed the
Replacemen variable.

Before b5595836 the code assumed that alloca
ptrs are not tagged so tagging is implemented
as simple OR.

So this patch completes support of tagged SP
by passing untagged alloca pointers into
tagPointer.
2023-04-30 18:26:58 -07:00
Joshua Cao
3db96aa89e [LangRef] Fix broken tail call optimization link 2023-04-30 18:17:48 -07:00